What is the difference between local and instance variables in Java?

java

Solution

One extra thing I can think of:

Instance variables are given default values, i.e., null if it's an object reference, and 0 if it's an int.

Local variables don't get default values, and therefore need to be explicitly initialized (and the compiler usually complains if you fail to do this).

Problem

Except the scope and the storage differences, are there any other major difference between instance and local variables in Java?

Original source

Related problems