JAVA Variables and Scope
JAVA Variables and Scope :
- JAVA Variables and Scope
- Java Contains three types of variables
- Instance Variables
- Static Variables
- Local Variable
- Life span of static variables is till the JVM or application shuts down
- Life time of Instance variables is till the Object lives.
- The life span of local variable is till it reaches the end of the method.
- Instance variable and Static variables are initialized be default, where as Local Variables are not initialized.
- Local variables must be initializing before using it.
- Static variables must be declared in class general area.
- It must not be declared in constructor, blocks and methods.
- Local Variables have only one modifier, which is FINAL.
Comments
Post a Comment