previous |
start |
next .... [Slide 19] ....
The this Reference
- Refers to implicit parameter of method call
- Example: Equality testing
public boolean equals(Greeter other)
{
if (this == other) return true;
return name.equals(other.name);
}
- Example: Constructor
public Greeter(String name)
{
this.name = name;
}
previous |
start |
next .... [Slide 19] ....