Wrapper Classes

1.Which of these is NOT a wrapper class in Java?
  • A. Integer
  • B. Float
  • C. Boolean
  • D. Characterize

Characterize

Characterize

2.What is the output of the following code?
Integer x = 100; Integer y = 100; System.out.println(x == y);
  • A. true
  • B. false
  • C. Compilation error
  • D. Exception

true

true

3.What is Autoboxing in Java?
  • A. Converting String to Integer
  • B. Converting primitive to Wrapper object
  • C. Converting Wrapper to primitive
  • D. Converting object to primitive

Converting primitive to Wrapper object

Converting primitive to Wrapper object

4.What will this code print?
int a = 10; Integer b = Integer.valueOf(a); System.out.println(b);
  • A. 10
  • B. 0
  • C. Error
  • D. null

10

10

5.Which method converts a String to an int primitive?
  • A. valueOf()
  • B. parseInt()
  • C. intValue()
  • D. toString()

parseInt()

parseInt()