Skip to content

Instantly share code, notes, and snippets.

@isaacssemugenyi
Created December 1, 2023 20:25
Show Gist options
  • Save isaacssemugenyi/55e677608ad43dac6849f32ab8b73b93 to your computer and use it in GitHub Desktop.
Save isaacssemugenyi/55e677608ad43dac6849f32ab8b73b93 to your computer and use it in GitHub Desktop.
Call the instance
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