answersLogoWhite

0

What is autoboxing in java?

User Avatar

Anonymous

16y ago
Updated: 8/16/2019

With the advent of Java 2.0 (yay!!!), now when a method expects an Object as its parameter can be passed a primitive data type (i.e. int, double, char) and automatically "box" it into its corresponding Wrapper Object (i.e. Integer, Double, Character), thus primitives could be passed as an Object parameter.

It also works the other way, "auto-unboxing" you can directly modify primitives Wrapper Objects with primitive operations(i.e. +, -, /, %)

For example:

Integer myInt = new Integer( 10 ); // creates an Integer holding 100

int yourInt = myInt * 10; // yourInt is now a primative holding 100

myInt = myInt * 10; // myInt also holds 100

User Avatar

Wiki User

16y ago

What else can I help you with?

Related Questions

What is AutoBoxing and UnBoxing in java 5?

Conversion of primitive data types automatically to their corresponding wrapper classes is called AutoBoxing and the reverse of this operation is called UnBoxing. Ex: Long L = new Long(100); long x = L; Now x will have a value 100.


What Indonesian island is Jakarta on?

java


Does Visual Java plus plus and Java Builder is different from the Java language?

Yes!Visual Java plus plus and Java Builder is different from the Java language?


What are the different java technologies?

There are several types of Java technology. Some examples of Java software are Java ME, Java EE, Java SE, and Java Card. Java made the JAVA development kit for those that develop in Java. There is also Java Virtual machine and some class libraries. Java is also famous for its languages like Clojure, Beanshell, Groovy, Gosu, Rhino, Kotlin, JRuby, Scala, and Jython.


Small Java-based programs are called?

Java applets


Who create Java and when?

Who create Java & when? Why he create java ? What are mane functions of it?


Supermost package of java?

The supermost package of Java is the "java" package.


What do you call java and javascript?

Well you get java as java and javascript as iava.


Differences between Java Applet and Java Beans?

Java applet is a program used to run java applications while beans is a compiler used to design java programs (IDE, GUI) :-) GilbertC


What country is known for its java coffee in the Java sea?

Java coffee is made in Java, which is an island - part of INDONESIA


What is java 7?

Java 7 is the most current version of Java. Many movies and games use Java.


What is java's purpose on my PC?

Programs that are specifically designed with Java require a Java runtime to work on a computer. (In the case of Java, the runtime is called "Java Virtual Machine".) If you have any such program, you need to have Java.