I don't understand the real difference between this two codes, despite the fact that they both work.
If I use this class:
public class City {
private String name;
I don't understand the difference between this method:
public String getName(){
return this.name;
}
And this one:
public String getName(){
return name;
}
The two methods work, but which one is the best to use, and why do they both work?
Thanks for the answers.