Instance variables can
It is legal to declare a local variable with the same name as an instance variable; this is called "shadowing."
The transient modifier applies only to instance variables.
The volatile modifier applies only to instance variables.
- Have any access control
- Be marked final or transient
It is legal to declare a local variable with the same name as an instance variable; this is called "shadowing."
- final variables have the following properties:
- final variables cannot be reinitialized once assigned a value.
- final reference variables cannot refer to a different object once the object has been assigned to the final variable.
- final reference variables must be initialized before the constructor completes.
The transient modifier applies only to instance variables.
The volatile modifier applies only to instance variables.
No comments:
Post a Comment