One extra thing I can think of:
Instance variables are given default values, ie null if it's an object reference, 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).
Local variable:
- is declared inside a method/constructor or within a block (enclosed in braces)
- must be initialized before use, otherwise it won't compile.
Instance variable:
- is declared inside a class.
- initialization is not compulsory: if omitted, it contains default value (0, 0.0,
false
,null
, etc.)