Advertisement
sergAccount

Untitled

Feb 14th, 2021
550
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.69 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package com.mycompany.ja12;
  7.  
  8. /**
  9.  *
  10.  * @author Admin
  11.  */
  12. public class SingleObject {
  13.    
  14.     private static SingleObject instance = new SingleObject();
  15.    
  16.     // приватный конструктор
  17.     private SingleObject(){
  18.         System.out.println("SingleObject created!!!");
  19.     }
  20.     //
  21.     public static SingleObject getInstance(){
  22.         return instance;
  23.     }
  24.     //
  25.     public void doSomething(){
  26.         System.out.println("doSomething!!!");
  27.     }
  28.    
  29.     //
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement