SHARE
TWEET

Untitled

a guest Mar 25th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class SingleObject {
  2.         private static SingleObject instance;
  3.    
  4.         private SingleObject( ) {}
  5.        
  6.         public static SingleObject getInstance() {
  7.             if(instance == null) {
  8.                 instance = new SingleObject();
  9.                 System.out.println("Yeni nesne yaratıldı.");
  10.             }
  11.             else
  12.                 System.out.println("Daha önce yaratılmış instance geri döndürüldü.");
  13.            
  14.             return instance;
  15.         }
  16. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top