5 min read
This study guide covers the this keyword in Java, including its use for referencing instance variables, as a parameter, and in constructor/method calls. It also demonstrates how to use this to overload constructors and finalize classes with examples using the Assignment and Student classes. The examples show adding overloaded constructors and new methods like newAssignment()
and getLetterGrade()
.
Give us your feedback and let us know how we can improve
Question 1 of 9
🎉 How does the this
keyword help in differentiating between instance and local variables with the same name?
It uses variableName
for instance variables and this.variableName
for local variables
It uses this.variableName
for instance variables and variableName
for local variables
It uses variableName()
for instance variables and this.variableName()
for local variables
It uses _variableName
for instance variables and variableName
for local variables