this keyword in java

Local Variable Hides Instance Variable In java when the local variable has the same name as an instance variable, the local variable hides the instance variable.

Result

In above program we have two instance variable with value a=10 and b=10. in method display there is a local variable a with value 5. Inside … Read more