01.What is WrapperClass?
The Wrapper Class is a class that wraps (or “converts”) a primitive data type into an object.
This allows primitives to be treated as objects, so you can use them in Collections or call methods on them.
02.What are the type of WrapperClass?
Primitive data type-8no's
WrapperClass:
int-Integer is class
char-Character
boolean-Boolean
short-Short
byte-Byte
long-Long
float-Float
double-Double
03.Why Wrapper Classes are Needed ?
1.Collections can’t store primitives
2.Automatic conversion with primitives
3.Primitives can’t be null
4.Generics require objects
04.Why Objects are in Heap, Not Stack?
Stack:
1.Static (fixed-size)
2.Short-lived (method scope)-Lifetime
3.Very fast (LIFO)-AccessSpeed
4.Primitive types, method calls
Heap:
1.Dynamic (resizable)
2.Long-lived (program scope)
3.Slower (needs more checks)
4.JVM
5.Objects, dynamic allocation
Top comments (0)