Created
December 1, 2023 20:25
-
-
Save isaacssemugenyi/55e677608ad43dac6849f32ab8b73b93 to your computer and use it in GitHub Desktop.
Call the instance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
public static void main(String[] args){ | |
Singleton new1 = Singleton.getInstance("John", 30); | |
Singleton new2 = Singleton.getInstance("Doe", 28); | |
System.out.println("new 1 "+ new1.getName()+" "+ new1.getAge()); | |
System.out.println("new 2 "+ new2.getName()+" "+ new2.getAge()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment