Advertisement
Guest User

Untitled

a guest
Jul 12th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. libreriaConSingleton.jar - dipendo da libreriaDipedente.jar
  2.  
  3. import libreriaDipedente.ClasseCheMiServe;
  4. class Singleton{
  5. private Singleton(){}
  6.  
  7. private Singleton mySingleton;
  8.  
  9. private ClasseCheMiServe dipedenza;
  10. private String host;
  11.  
  12. private Singleton(host,username, password){
  13. dipedenza = new ClasseCheMiServe(username,password);
  14. }
  15.  
  16. public static getInstance(){
  17. if (mySingleton == null)
  18. return new Singleton("pinco",pallo");
  19. }
  20. }
  21.  
  22. __
  23.  
  24. import libreriaConSingleton.Singleton;
  25.  
  26. class Test{
  27. public void doAction(String[] args){
  28. Singleton test= Singleton.getInstance(); // come faccio a capire che la classe dipende da libreriaDipedente.jar se sto chiamando solo libreriaConSingleton?
  29. }
  30. }
  31.  
  32. class Test2{
  33. public void doAction(String[] args){
  34. Singleton tes2= Singleton.getInstance();
  35. }
  36. ...
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement