Question: Please download Test.java file from Blackboard under LAB 1 folder. Your task is to modify the Singleton class inside the Test.java file, so that it

Please download Test.java file from Blackboard under LAB 1 folder.
Your task is to modify the Singleton class inside the Test.java file, so that it allows creation of only one
instance of Singleton.
Write a main to test your program.
Add a sub-class to your hierarchy with the name SubSingleton. Instead of Singleton class, use SubSingleton
to test your main. Modify your code if needed.
Lastly, change the number of SubSingleton instances that can be created. Singleton class allows the creation
of just one instance. SubSingleton should allow three. Use the following guidelines
Test class:
package lab1;
class Singleton {
String name;
public Singleton(String name){
this.name = name;
}
public String toString(){
return name;
}
}
public class TEST {
public static void main(String[] args){
System.out.println(new Singleton("I1"));
}
}
 Please download Test.java file from Blackboard under LAB 1 folder. Your

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!