Java SE 8 Programmer 1Z0–808 Practice Full Test 1
© examsiri.com
Question : 83 of 84
Marks:
+1,
-0
public class Rectangle {
private double length;
private double height;
private double area;
public void setLength(double length) {
this.length = length;
}
public void setHeight(double height) {
this.height = height;
}
public void setArea() {
area = length * height;
}
} Which two changes would encapsulate this class and ensure that the area field is always equal to length * height whenever the Rectangle class is used?
Go to Question: