public class Size { double height; double width ; //default constructor public Size(){ this.height = 11; this.width = 8.5; } public Size(double height, double width){ this.height = height; this.width= width; } public double getHeight(){ return height; } public double getWidth(){ return width; } public void setHeight(double ht){ height = ht; } public void setWidth(double wd){ width = wd; } public boolean equals(Size sz){ if (sz.getHeight()==this.getHeight() && sz.getWidth()== this.getWidth()) { return true; } else { return false; } } public static void main(String[] args) { Size size1 = new Size (); Size size2 = new Size (11, 8.5); //height, width if (size1.equals(size2)){ System.out.println("Equal size"); } else { System.out.println("Unequal size"); } } }