Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is the singleton class in java?

Answer Posted / naman patidar

A singleton class can never have more then one instance.
Example :

class SingletonClass {
private static SingletonClass singleObject;

public static SingletonClass getInstance() {
if (singleObject == null) {
singleObject = new SingletonClass();
}
return singleObject;
}
}

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why bean class is used in java?

857


I run a web server. Am I at risk? : java security

838


Explain working of java virtual machine (jvm)?

947


How do you count in java?

866


How does jpa repository work?

868


what is reflection api? How are they implemented?

955


Explain issues of old java date api?

950


What is custom tag in java?

854


What is lambda expression in mvc?

919


What is the java api?

858


Why oracle type 4 driver is named as oracle thin driver?

796


Can an application have multiple classes having main method?

868


What is ehcache in java?

902


What is the difference between Logical Parallelism and Physical Parallelism?

3346


Explain the inheritance principle.

879