Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: James Rivera   on Jul 31 In Java Category.

  
Question Answered By: Milton Robinson   on Jul 31

No, because internal methods of the class can still contruct an
instance:

public final class MySingleton{

private MySingleton(){

}

public static MySingleton getInstance(){
return mySingletonInstance;
}

private static MySingleton mySingletonInstance = new MySingleton();

}

Share: 

 

This Question has 28 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Why we declare the constructor private? Or get search suggestion and latest updates.


Tagged: