public class Construct2 {
	private Construct2() {
		System.out.println("hello world");
	} //constructor

	public static void main(String[] args) {
		new Construct2();
		/* new OtherClass(); would fail since constructor is declared to be private */
		OtherClass oc = OtherClass.OtherClassFactory(); //object creation using simple factory approach
	} //main()
} //class Construct2

class OtherClass {
	public static OtherClass OtherClassFactory() {
		return new OtherClass();
	} //constructor

	private OtherClass() {
		System.out.println("other class created");
	} //constructor
} //class OtherClass