Skip to content

RectangleTest1.java #20

@parallelinertia04

Description

@parallelinertia04

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions