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: Rene Sullivan   on Jul 31

No, a class with a private constructor  is still a concrete class. This
ensures that only one object can ever be created.

Example:
class Test{
private static Test test = new Test();
private Test(){}
public static Test getTest(){
return test;
}

}

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: