-
Notifications
You must be signed in to change notification settings - Fork 388
Open
Description
Issue in return 2*(length+breadth)
Used getLength() and getBreadth() in area() method- to maintain consistency in use . If the variables length and breadth are private, then directly accessing them outside the class (or even inside, when setters/getters exist) breaks the encapsulation.
public double perimeter() {
return 2 * (getLength() + getBreadth());
}
Metadata
Metadata
Assignees
Labels
No labels