Kotlinlearncs.online LogoJava
Return to List

Solve: Point Class Add Setters

Created By: Ellen Spertus
/ Version: 2023.12.0

Make x and y changeable by removing the final keyword and adding setters.

public class Point {
private final double x;
private final double y;
public Point(double newX, double newY) {
x = newX;
y = newY;
}
public double getX() {
return x;
}
public double getY() {
return y;
}
}

Related Lessons

Stuck? You may find these lessons helpful: