What is the difference between Local and Instance variable in Java?

Local Variable Instance Variable
Local variables are stored in Stack. Instance variables are stored in Java Heap.
Local variables should be initialized before it is being used. Otherwise, Compiler will thrown an error Instance variables are initialized to default value when a new instance is created.
The default values are as follows,
int/byte/short/long -> 0
float/double -> 0.0
boolean -> false
char -> '\u0000'
Object -> NULL
Interview Questions: 

Search