My teacher says that when I try to access an instance variable within a method I should always use the this keyword, otherwise I would perform a double search.
this only applies to the case where a parameter has the same name as a class property.
public class Dog {
String name;
public Dog(String name) {
name = name; //but which name? Are we just assigning a variable to itself?
// here you could say this.name = name. Or you could rename one of the variables to resolve ambiguity
}
}