is it possible to create single instance of java class per
session in web application

Answer Posted / sk.bilal ahmed

yes
eg.,
Public final class Singleton{

private static Singleton singleton;

public static Singleton getInstance()
{
if(singleton ==null)
{
singleton=new Singleton();
}
retuen singleton;
}

public void getvalue()
{

}

}

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How java is reliable?

484


What is callback methods?

534


What is actionform?

553


What is B2B?

564


What is 2 stands for in j2ee?

516






How do you run a java program?

466


What is java ee technologies?

466


What is difference between java and core?

460


I am newbie in J2EE & looking for strong basic behind each concept as, Why do we use private access specifier before each variable of type property bcoz ultimately to access it outside the class we use public method as getter & setter ? If we use getter & setter to access it outside the class so better we make variable as public so that it is easily available outside of the class... Please guide me why do we use as private ????

4998


What is client-certificate authentication?

549


What is declarative security ?

572


How many types of constructors are there in java?

455


What is deployment descriptor?

576


Is java is fully object oriented?

514


How do I become an expert in java?

479