"Pawan Kumar".toUpperCase(); // "PAWAN KUMAR"
Are primitives also objects?
Let’s deep dive into the concept.
Conceptually, primitives don’t have methods.
What exactly happens behind the scene
That’s because when write something like
(new String("Pawan Kumar")).toUpperCase()
and this object wrapper has all the methods of String Class. Once the operation is done, this object wrapper is collected by almighty garbage collection leaving the the primitive alone