April 2019
Intermediate to advanced
360 pages
9h 17m
English
In Java, we can use the this keyword as a reference to the current object. For example, the following code snippet sets the color of the current Bicycle object:
public void setColor(String theColor) { this.color = theColor; }
The preceding setColor method accepts a String parameter and assigns it to the color instance variable of the current object.
Read now
Unlock full access