jgs 460 00010010 Singleton class Main { public static void main(String []a){ // Constructor is protected -- cannot use new Singleton s1 = Singleton.getInstance(); Singleton s2 = Singleton.getInstance(); // Test for same instance if (s1 == s2){ // true - Objects are the same instance } } }
jgs 460 00010010 ConcreteHandler1 class ConcreteHandler1 extends Handler { public void HandleRequest(int request) { System.out.println("I am the last in line"); } }
jgs CSE 460 Software Analysis and Design Javier Gonzalez-Sanchez [email protected] Fall 2020 Disclaimer. These slides can only be used as study material for the class CSE460 at ASU. They cannot be distributed or used for another purpose.