File tree Expand file tree Collapse file tree 4 files changed +51
-0
lines changed
src/main/java/com/iluwatar Expand file tree Collapse file tree 4 files changed +51
-0
lines changed Original file line number Diff line number Diff line change 2222 <module >builder</module >
2323 <module >factory-method</module >
2424 <module >prototype</module >
25+ <module >singleton</module >
2526 </modules >
2627</project >
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" ?>
2+ <project xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns =" http://maven.apache.org/POM/4.0.0"
3+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" >
4+ <modelVersion >4.0.0</modelVersion >
5+ <parent >
6+ <groupId >com.iluwatar</groupId >
7+ <artifactId >java-design-patterns</artifactId >
8+ <version >1.0-SNAPSHOT</version >
9+ </parent >
10+ <groupId >com.iluwatar</groupId >
11+ <artifactId >singleton</artifactId >
12+ <version >1.0-SNAPSHOT</version >
13+ <name >singleton</name >
14+ <url >http://maven.apache.org</url >
15+ <dependencies >
16+ <dependency >
17+ <groupId >junit</groupId >
18+ <artifactId >junit</artifactId >
19+ <version >3.8.1</version >
20+ <scope >test</scope >
21+ </dependency >
22+ </dependencies >
23+ </project >
Original file line number Diff line number Diff line change 1+ package com .iluwatar ;
2+
3+ public class App
4+ {
5+ public static void main ( String [] args )
6+ {
7+
8+ IvoryTower ivoryTower1 = IvoryTower .getInstance ();
9+ IvoryTower ivoryTower2 = IvoryTower .getInstance ();
10+ System .out .println ("ivoryTower1=" + ivoryTower1 );
11+ System .out .println ("ivoryTower2=" + ivoryTower2 );
12+
13+ }
14+ }
Original file line number Diff line number Diff line change 1+ package com .iluwatar ;
2+
3+ public class IvoryTower {
4+
5+ private static IvoryTower instance = new IvoryTower ();
6+
7+ private IvoryTower () {
8+ }
9+
10+ public static IvoryTower getInstance () {
11+ return instance ;
12+ }
13+ }
You can’t perform that action at this time.
0 commit comments