Log in

View Full Version : What is autoboxing and unboxing ?



priya01
07-02-2016, 08:38 AM
What is autoboxing and unboxing ?


introduction to programming (https://gogotraining.com/training/courses/287/introduction-to-programming-and-coding-for-everyone-with-javascript/) oracle dba training (https://gogotraining.com/training/courses/288/oracle-12c-database-administration-i-part-1/) java se 8 programming (https://gogotraining.com/training/courses/306/java-se-8-programming-part-1/) itil service operation training (https://gogotraining.com/training/courses/237/itil-2011-service-operation--axelos-and-exin-accredited-training/)

arianagrand
07-04-2016, 06:15 AM
When Java automatically converts a primitive type like int into corresponding wrapper class object e.g. Integer than its called autoboxing because primitive is boxed into wrapper class while in opposite case is called unboxing, where an Integer object is converted into primitive int.

BrilltechEngg
07-11-2016, 08:55 AM
Autoboxing is the automatic conversion that the Java compiler makes between the primitive types and their corresponding object wrapper classes. For example, converting an int to an Integer, a double to a Double, and so on. If the conversion goes the other way, this is called unboxing.

Bluesky94
10-31-2016, 10:29 AM
Autoboxing is the automatic conversion that the Java compiler makes between the primitive types and their corresponding object wrapper classes.

AjayGohil
03-19-2019, 05:42 AM
Auto boxing is to used of Converting a primitive value into an object of the corresponding wrapper class is called auto boxing. For example, converting int to Integer class.and the Unboxing is to used Converting an object of a wrapper type to its corresponding primitive value is called unboxing. For example conversion of Integer to int.
the example of this

import java.io.*;

class Demo
{
public static void main (String[] args)
{

Integer i = new Integer(10);


int i1 = i; // unboxing the Object

System.out.println("Value of i: " + i);
System.out.println("Value of i1: " + i1);


Character gfg = 'a'; //Autoboxing of char

char ch = gfg;
System.out.println("Value of ch: " + ch);
System.out.println("Value of gfg: " + gfg);

}
}
http://www.ifourtechnolab.com/

Mangat Singh
03-20-2019, 02:30 AM
Autoboxing is the automatic conversion that the Java compiler makes between the primitive types and their corresponding object wrapper classes. For example, converting an int to an Integer, a double to a Double, and so on. If the conversion goes the other way, this is called unboxing.

tonikalra
04-12-2019, 07:46 AM
Autoboxing and Unboxing. Autoboxing is the automatic conversion that the Java compiler makes between the primitive types and their corresponding object wrapper classes. For example, converting an int to an Integer, a double to a Double, and so on. If the conversion goes the other way, this is called unboxing.

Servers Base
05-22-2019, 03:30 PM
Autoboxing: Automatic conversion of primitive types to the object of their corresponding wrapper classes is known as autoboxing. For example – conversion of int to Integer, long to Long, double to Double etc.
Unboxing: It is just the reverse process of autoboxing. Automatically converting an object of a wrapper class to its corresponding primitive type is known as unboxing. For example – conversion of Integer to int, Long to long, Double to double etc.

Piyusha
05-23-2019, 05:35 AM
Autoboxing is the automatic conversion that the Java compiler makes between the primitive types and their corresponding object wrapper classes. For example, converting an int to an Integer, a double to a Double, and so on. If the conversion goes the other way, this is called unboxing.

NoahKlindon
05-30-2019, 08:35 AM
Autoboxing is the programmed change that the Java compiler makes between the crude sorts and their comparing object wrapper classes. For instance, changing over an int to an Integer, a double to a Double, etc. On the off chance that the conversion goes the other way, this is called unboxing.

bmINDIA
06-03-2019, 06:56 AM
Thanks for the great post.

Lukedawn
06-03-2019, 07:10 AM
Autoboxing is the automatic conversion that the Java compiler makes between the primitive types and their corresponding object wrapper classes, If the conversion goes the other way, this is called unboxing.