This is an excellent question ,
I assume when you say size of the class you meant the size of the object of the class
In a 32 bit os
Integer object takes 128 bytes
32 bit class pointer to class type
32 bit flags
32 bits locks
32 bits data ie int
String is basically an array of char
So we have 2 objects
java.lang.Sting and char[]
So if u look inside the String class we have
Hash cont offset and value ie pointer to char array
So again
32 bit class pointer to class type
32 bit flags
32 bits locks
32 bits Hash
32 bits count
32 bits offset
32 bit pointer to char array
124 bits
char[] again has size and characters
So
32 bit class pointer to class type
32 bit flags
32 bits locks
32 bits size
10 bits for actual char in ur case Anuj Kumar
138 bits
Again we have the Example class
32 bit class pointer to class type
32 bit flags
32 bits locks
32 bits for String pointer
32 bits for Integer wrapper
160 bits
Hence total size should be somewhere around 160+138+124 bits = 422 bits
Please take a look at this talk https://www.youtube.com/watch?v=FLcXf9pO27w which wonderfully expains the same
Not sure why people have downvoted the question instead of answering it