renaming the variable

This commit is contained in:
mherbaghinyan 2018-05-14 11:21:52 +04:00
parent ca78752618
commit 5b7c29e7bf
1 changed files with 6 additions and 6 deletions

View File

@ -5,19 +5,19 @@ package com.baeldung.scope.variable;
*/
public class HideVariable {
private String instanceVariable = "this is instance variable";
private String message = "this is instance variable";
HideVariable() {
instanceVariable = "constructor local variable";
System.out.println(instanceVariable);
String message = "constructor local variable";
System.out.println(message);
}
public void printLocalVariable() {
instanceVariable = "method local variable";
System.out.println(instanceVariable);
String message = "method local variable";
System.out.println(message);
}
public void printInstanceVariable() {
System.out.println(this.instanceVariable);
System.out.println(this.message);
}
}