Java Labprogram 7
Java Labprogram 7
and resizeHeight(int height) that allow an object to be resized. Create a class Rectangle that
Solution:-
interface Resizable
// Constructor
this.width = width;
this.height = height;
this.width = width;
}
public void resizeHeight (int height)
this.height = height;
r.getDimensions ();
r.resizeWidth (8);
r.resizeHeight (10);
rectangle.getDimensions ();
}
Compile As: javac rect_resize.java
Output:
Original Dimensions:
Width: 5, Height: 7
Resized Dimensions:
Width: 8, Height: 10