Wrapper Classes

16.What is the result of unboxing?
  • A. Object becomes primitive
  • B. Primitive becomes Object
  • C. NullPointerException always
  • D. Compilation error

Object becomes primitive

Object becomes primitive

17.What will the following code display?
Integer x = 200; Integer y = 200; System.out.println(x == y);
  • A. true
  • B. false
  • C. Error
  • D. null

false

false

18.What is the output?
Boolean b1 = Boolean.valueOf("true"); Boolean b2 = Boolean.valueOf("false"); System.out.println(b1 + " " + b2);
  • A. false false
  • B. true false
  • C. false true
  • D. true true

true false

true false

19.Which of the following is NOT a valid wrapper class method?
  • A. parseBoolean(String)
  • B. toString()
  • C. toInt()
  • D. doubleValue()

toInt()

toInt()