Source of Rectangle2.java


  1: //Rectangle2.java
  2: 
  3: /**
  4:  * Another class that represents a rectangle.
  5:  */
  6: public class Rectangle2
  7: {
  8:     private int width;
  9:     private int height;
 10: 
 11:     public void setDimensions
 12:     (
 13:         int newWidth,
 14:         int newHeight
 15:     )
 16:     {
 17:         width = newWidth;
 18:         height = newHeight;
 19:     }
 20: 
 21:     public int getArea()
 22:     {
 23:         return width * height;
 24:     }
 25: }