renaming the variable
This commit is contained in:
parent
ca78752618
commit
5b7c29e7bf
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue