Skip to content

Commit f64fb10

Browse files
committed
Added sample output java files for Singleton
1 parent e2802bc commit f64fb10

File tree

10 files changed

+78
-0
lines changed

10 files changed

+78
-0
lines changed

outputs/.idea/.gitignore

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

outputs/.idea/codeStyles/codeStyleConfig.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

outputs/.idea/misc.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

outputs/.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

outputs/.idea/outputs.iml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

outputs/.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.CreationalDP.prototype;
2+
3+
public class Client {
4+
private Prototype prototype;
5+
6+
public Client(Prototype prototype) {
7+
this.prototype = prototype;
8+
}
9+
10+
public static void main(String[] args) {
11+
Prototype prototype = new Prototype;
12+
Prototype prototypeCopy = prototype.copyMe();
13+
}
14+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.CreationalDP.prototype;
2+
3+
public abstract class Prototype implements Cloneable {
4+
abstract Prototype copyMe() throws CloneNotSupportedException;
5+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.CreationalDP.prototype;
2+
3+
public class concretePrototype extends Prototype {
4+
public Prototype copyMe() throws CloneNotSupportedException {
5+
return (Prototype) this.clone();
6+
}
7+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.CreationalDP.singleton;
2+
3+
public class Singleton {
4+
private static Singleton INSTANCE;
5+
6+
private Singleton() {
7+
}
8+
9+
public static Singleton getInstance() {
10+
if (INSTANCE == null) {
11+
INSTANCE = new Singleton();
12+
}
13+
return INSTANCE;
14+
}
15+
}

0 commit comments

Comments
 (0)