- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobject.java
More file actions
Latest commit
28 lines (23 loc) · 523 Bytes
/
Copy pathobject.java
File metadata and controls
28 lines (23 loc) · 523 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
classSingleton
{
privatestaticSingletonsingle=null;
privateSingleton()
{
}
publicstaticSingletongetInstance()
{
if( single == null)
{
single = newSingleton();
}
returnsingle;
}
}
publicclassobject {
publicstaticvoidmain(String[] args)
{
Singletoninstance1= Singleton.getInstance();
Singletoninstance2 = Singleton.getInstance();
System.out.println(instance1 + " " + instance2);
}
}