Q. Which method is used to convert a primitive to its wrapper class?

A
valueOf()
B
toObject()
C
wrap()
D
convert()
Solution:

The valueOf() method (e.g., Integer.valueOf()) converts a primitive to a wrapper object.

Entri Contact Image

Get Expert Advice for Free: Register for Your Free Consultation Now!