Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.javarush.test.level14.lesson08.bonus03;
- /**
- * Created by User on 23/01/17.
- */
- class Singleton {
- private static Singleton instance; //declare our singleton, private static == can be called ONLY form singleton itself!
- private Singleton() //constructor does nothing
- {
- }
- public static Singleton getInstance() // return our Singleton
- {
- if (instance == null) instance=new Singleton(); // if no singleton was created - create the first and only one
- return instance;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement