- primitive type
- reference type
Method parameters and constructor parameters are also local variables but they are initialised by the calling method.
Variables defined outside the method are created when the object is created with new xxx() call.There are 2 possible types of this variables.
- The first kind is declared using the static keyword.
- The second variable is instance variable that is declared without the static keyword.
Method parameter variables define argument passed in a method call.
Local VARIABLES are created when execution enters the method and are destroyed when the method is exited.That is why variables are sometimes referred as temporary or automatic.
No comments:
Post a Comment