DevJourney · code I wrote while learning
main.java
320 Bclass Rectangle {
private double width;
private double height;
// Constructor
public Rectangle(double width, double height) {
this.width = width;
this.height = height;
}
// Method to calculate and return area
public double getArea() {
return width * height;
}
}