Monday, 9 March 2020

Autoboxing and Unboxing in Java

Autoboxing and Unboxing in Java

Hi guys! Welcome you again to brajeshNotes. In today's session , we will talk about what is auto boxing and auto unboxing in java. So lets start without spending too much time 😊


Autoboxing : Process of converting the primitive value into its corresponding wrapper class value is called auto boxing. 

For example converting int to Integer class. Java compiler applies auto boxing when a primitive value is :

  • Passed as parameter to a method and expect a corresponding wrapper class value.
  • Assign to a variable of corresponding wrapper class.
Unboxing : Process of converting the wrapper value into its corresponding primitive value is called unboxing. 


For example converting Integer to int . Java compiler applies unboxing when a wrapper value is :

  • Passed as parameter to a method and expect a corresponding primitive type value.
  • Assign to a variable of corresponding primitive type.
Below table listed the primitive type and there corresponding wrapper classes , which are used by java compiler during autoboxing and unboxing process.

PRIMITIVE
WRAPPER
boolean
Boolean
bye
Byte
char
Character
float
Float
int
Integer
long
Long
short
Short
double
Double


Related Posts:

  • IBM: Rational ClearCase all cleartool commandsIBM: Rational ClearCase all cleartool commandsHi Friends 😊, In today's blog we will talk about some important Cleartool commands which are very useful when you are working with IBM rational ClearCase tool.What is IBM Rationa… Read More
  • Introduction to Ajax Ajax is not a programming language. It is combination of java script and xml, so we can say say that ajax = java Script+xml. In another word,Ajax means, Asynchronous java script and xml, and this is  made popular i… Read More
  • Java 8 Functional Interface with examples Java Functional Interfaces An interface having only single abstract method is called functional interface 😊. You can either use the predefined functional interface provided by Java or create your own functi… Read More
  • How to manually install the Securly SSL certificate in Chrome How to manually install the Securly SSL certificate in Chrome You would want to install the Securly SSL certificate in your Chrome browser to ensure the best browsing experience. The certificate does not control the level … Read More
  • Autoboxing and Unboxing in JavaAutoboxing and Unboxing in JavaHi guys! Welcome you again to brajeshNotes. In today's session , we will talk about what is auto boxing and auto unboxing in java. So lets start without spending too much time 😊 Autoboxing… Read More

0 comments:

Post a Comment