class Square { private int x; public Square() { } public Square(int x) { this.x=x; } public Square(int x, int y) { if (x!=y) System.out.println("Error!Using 1st input"); this.x = x; } public int getPerim() { return 4*x; } // public void getPerim() { } // won't work! public void getPerim(String s) { System.out.println(s+getPerim()); } } public class squares { public static void main(String[] args) { Square s1 = new Square(); Square s2 = new Square(1); Square s3 = new Square(2,1); System.out.println(s2.getPerim()); s3.getPerim("The perimeter is "); } } /* output: Error! Using first input. 4 The perimeter is 8 */