FileDocCategorySizeDatePackage
SingletonCheat2.javaAPI DocExample491Sun Feb 08 21:33:58 GMT 2004None

SingletonCheat2

public class SingletonCheat2 extends Singleton
Cheat on a Singleton by cloning it?

Fields Summary
Constructors Summary
Methods Summary
public java.lang.Objectclone()

		Object n;
		try {
			n = super.clone();
		} catch (CloneNotSupportedException ex) {
			System.out.println("caught it now! " + ex);
		}
		return n;
	
public static voidmain(java.lang.String[] args)

		SingletonCheat2 s1 = (SingletonCheat2)SingletonCheat2.getInstance();
		System.out.println(s1);

		Object s2 = s1.clone();
		System.out.println(s2);