FileDocCategorySizeDatePackage
SingletonCheat1.javaAPI DocExample358Sun Feb 08 21:33:58 GMT 2004None

SingletonCheat1

public class SingletonCheat1 extends Object
Cheat on a Singleton by calling its clone method?

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

		Singleton s = Singleton.getInstance();
		try {
			s.clone();	// EXPECT COMPILE ERROR - clone is protected!
		} catch (CloneNotSupportedException ex) {
			System.out.println("You can'd do it this way either: " + ex);
		}