Question: Question 2 Suppose you have an application that needs to have only one object (instance) created for a given class (e.g., there is only one
Question 2
Suppose you have an application that needs to have only one object (instance) created for a given class (e.g., there is only one university called University of Houston). Which is the design pattern proper to use in this case? Write a Java code so that your final program will respect this requirement. Also, show what happens when you try to create two objects of that class. Illustrate a way to access the private attributes of that class.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
