1~

Minter Coder's Blog

Chapter 2 - Soru 45

2021-03-18

45. Fill in the blanks to indicate whether a primitive or wrapper class can be assigned
without the compiler using the autoboxing feature.
_______first = Integer.parseInt("5");
_______second = Integer.valueOf("5");
A. int , int
B. int , Integer
C. Integer , int
D. Integer , Integer

Açıklamayı kendim yapmak isterdim ama cevap anahtarında daha açıklayıcı anlatmış çünkü işi türkçeye dökünce satır uzuyo :)

B. The parseInt() methods return a primitive. The valueOf() methods return a
wrapper class object. In real code, autoboxing would let you assign the return value to
either a primitive or wrapper class. In terms of what gets returned directly, Option B is
correct.