Created
December 27, 2020 22:23
-
-
Save reime005/874cc32eccbc7fc40964df7748fdc649 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ThisClass { | |
private int someValue; | |
public void setSomeValue(int someValue) { | |
this.someValue = someValue; | |
} | |
public int getSomeValue() { | |
return this.someValue; // works without 'this' | |
} | |
public static void main(String[] args) { | |
ThisClass thisClass = new ThisClass(); | |
System.out.println(thisClass.getSomeValue()); // 0 | |
thisClass.setSomeValue(42); | |
System.out.println(thisClass.getSomeValue()); // 42 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment