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...

how to implement singletun design patteren in struts?

Answer Posted / shaik baji

Singletun design patteren means we can't create more than
one object for that class which follws Singletun design
pattern.

We can implement it by using one "private" constructor and
one Factory mathod as like follows:

class Sample
{
public static Sample s = new Sample();

private Sample()//constructor
{

}
public static Sample getInstance()//static factory
method
{
return s;
}
}

public class SingleTun
{
public static void main(String arg[])
{
Sample s1= Sample.getInstance();
Sample s2= Sample.getInstance();

}

}

Is This Answer Correct ?    5 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between Jakarta Struts and Apache Struts? Which one is better to use?

1067


Mark the differences between html tags and strut specific html tags.

1039


Why do we need struts?

969


What is the need of struts?

1025


What is the purpose of @key annotation annotation?

1131


What do you mean by tiles in struts?

1074


Why was reload removed from struts (since 1.1)?

1029


What is the purpose of struts.properties in struct2?

990


What is the purpose of @results annotation?

1384


What are the core classes of struts?

1105


How we can controlled duplicate form submission in struts?

993


Explain about the validation steps which have to be carried during validation of client-side address?

1036


Explain the complete struts validator framework.

1075


Is there a particularly good ide to use with struts?

985


What is struts 2 framework in java?

1082