Computer Applications
What is Autoboxing in Java? Give an example.
Java Library Classes
16 Likes
Answer
The automatic conversion of primitive data type into an object of its equivalent wrapper class is known as Autoboxing. For example, the below statement shows the conversion of an int to an Integer.
Integer a = 20;
Answered By
6 Likes
Related Questions
Give the output of the following code:
String P = "20", Q ="19"; int a = Integer.parseInt(P); int b = Integer.valueOf(Q); System.out.println(a+""+b);String s1 = "45.50"; String s2 = "54.50"; double d1=Double.parseDouble(s1); double d2=Double.parseDouble(s2); int x= (int)(d1+d2);What is value of x?
The method to convert a String to double is:
- String.toDouble()
- Double.Parsedouble()
- Double.parseDouble(String)
- Double.parseDouble()