Daniel Torales wrote:I simply cannot understand what this.door = door means
There are two
door variables in scope at the point of that statement: one instance variable, and the parameter.
this.door references the instance variable, the this. prefix mean to look for the variable in the current instance
door refers to the parameter
So
this.door = door sets the instance variable to the parameter.
Consider if the parameter were named differently:
Same code, different names.
It's conventional to use the same name.
If the statement were written
door = door it wouldn't work because both references would be to the parameter, assigning it to itself (which is pretty useless).