Skip to content

Instantly share code, notes, and snippets.

@ajduke
Created August 19, 2012 08:58
Show Gist options
  • Save ajduke/3393808 to your computer and use it in GitHub Desktop.
Save ajduke/3393808 to your computer and use it in GitHub Desktop.
public class Shape {
private int length;
private int width;
private Shape(int length, int width) {
// this constructs rectangle
this.length = length;
this.width = width;
}
private Shape(int length) {
// Constructs the square
// by invoking the another constructor
this(length, length);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment