when a variable is initialize both in local scope as well as global scope how can we use global scope without using this
keyword in the same class?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Also See :
If you do not use
this
it will always be the local variable.If you are scoping the variable reference with
this
it will always point to the instance variable.If a method declares a local variable that has the same name as a class-level variable, the former will 'shadow' the latter. To access the class-level variable from inside the method body, use the this keyword.
It is impossible without this. The phenomenon is called variable hiding.