Learn Java: Wrapperclass

Topics: All about Wrapperclass'

Browse all answers:

What are Wrapper Classes? Describe the wrapper classes in Java.?
What are wrappers?
What are Utility methods in java?
Explain conversion toHexString?
Which of the following statements are true?
What will happen when you attempt to compile and run the following code?public class WrapMat{    public static void main(String argv[]){    Integer iw = new Integer(2);    Integer iw2 = new Integer(2);    System.out.println(iw * iw2);    System.out.println(iw.floatValue());   }}1 )Compile time error2) Compilation and output of 4 followed by 2.03) Compilation and output of 4 followed by 24) Compile time error, the Integer class has no floatValue method
What will happen when you attempt to compile nad run the following code?public class TwoEms {    public static void main(String argv[]){        Object[] oa = new Object[3];        oa[0] = new Integer(1);        int i = oa[0];        System.out.print(i);            }    }1) Compile time error an array cannot contain object references2) Compile time error elements in an array cannot be anonymous3) Compilation and output of 14) Compile time error Integer cannot be assigned to int5) Compilation and output of the memory address of the Integer instance
What will happen when you attempt to compile and run the following code?public class TwoPack {    public static void main(String argv[]){        Integer iw = new Integer(“2”);        Integer iw2 = new Integer(“2”);        String sOut = iw + iw2;        System.out.println(sOut);            }    }1) Compile time error, the + operator cannot be applied to Integer2) Compilation and output of 223) Compilation and output of 44) Compile time error, Integer has no String constructor
Which of the following is valid code?1) System.out.println(Integer.toBinaryString(4));2) System.out.println(Integer.toOctalString(4));3) System.out.println(Integer.add(2,2));4) Float[] ar = new Float[] { new Float(1.0), new Float(2.1)};
Insert an object with the add(Object) method