16 solutions available
Question 1What are wrapper classes?
Question 2Name the numeric wrapper classes in Java.
Question 3What is the need of wrapper classes when there are primitive datatypes ?
Question 4When do the numeric wrapper class constructors raise NumberFormatException ?
Question 5Name some methods that are commonly available in all wrapper classes and in all numeric wrapper classes.
Question 6What is autoboxing ? What is auto-unboxing ? How are these useful ?
Question 9Predict the output.int res = Integer.valueOf("100").compareTo(new Integer(100)); System.out.println(res);
Question 10Find the error:Integer obj = new Integer("A"); System.out.println(obj);
Question 11Find the error :double n2 = Double.parseDouble("2"); double n3 = Double.parseDouble("OCA"); System.out.println(n2 + " " + n3);
Question 12Predict the output :double n1 = Double.parseDouble("8.0"); double n2 = Double.parseDouble("2"); System.out.println(n1 + " " + n2);
Question 13What important is automatically happening in following code ?long a = 124235L; Long b = new Long(a); long c = b.longValue();...
Question 14Predict the output :Integer c = 155; Integer d = 155; System.out.println(c == d); System.out.println(c.equals(d));
Question 15In the following code, identify the statement where autoboxing is taking place :Integer i = new Integer(10); if (i < 100)...
Question 16From the following code, do the following :(i) find its output.(ii) find out the statements where autoboxing is taking place.(iii) find...
Question 7Which of the following statements are true ?The Integer class has a String- and an int-constructor.The Integer has a floatValue( )...
Question 8What is the output of this program?class Output { public static void main(String args[]) { Integer i = new Integer(257);...