Skip to content

Instantly share code, notes, and snippets.

@reime005
Created December 27, 2020 22:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reime005/874cc32eccbc7fc40964df7748fdc649 to your computer and use it in GitHub Desktop.
Save reime005/874cc32eccbc7fc40964df7748fdc649 to your computer and use it in GitHub Desktop.
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