I have a doubt in Java wrapper class like Integer
, Character
. I know that when we declare a class Abc
and can create an object to it in Java like
Abc a = new Abc();
It instantiates a with reference to Abc
class and in that we have fields that contain values for variables. My doubt being, when we create Integer
class like:
Integer i = 5;
How is it pointing to value 5
? Should not it contain a field which contains its value and point to Integer
object like:
static int value; // To hold value 5 for Integer class