Local Variables : variables that are declared inside a method or instance initializer blocks.They only have scope with the code block where they are declared. They have to be initialised & are not assigned any default values.
Instance Variables : variables that require you to create an instance of the class to access them. They have class scope. Member variables are instance variables & they are assigned default values.
Default values :
false for boolean type
null for object type
0 for primitives
'\u0000' for char type
arrays of object type - null in each element.
arrays of primitive type - 0 in each element.
Originally posted by sonir shah:
Hello
What is the difference between
a) Instance Variables
b) Local Variables
c) Member Variables
Hope this helps.
Anybody else.. do fill in what I have missed.
Are they the same? if not give proper explainations