Latest Tutorials| Questions and Answers|Ask Questions?|Site Map




Have Programming Question? Ask it here!
 
 
 


mamatha
singleton
1 Answer(s)      6 years and 2 months ago
Posted in : Java Interview Questions



Advertisement
View Answers

June 14, 2008 at 3:46 PM


hi friend,

import java.io.*;

public class SingletonExam implements Serializable {

public static SingletonExam single;

protected SingletonExam(){
// Exists only to thwart instantiation.
}

private Object readResolve(){
return single;
}

public static void main(String args[]){
System.out.println("welcome back");
single = new SingletonExam();
single.readResolve();

}
}


-----------------------------------------------------

Read for more information.

http://www.roseindia.net/javatutorials/J2EE_singleton_pattern.shtml

Thanks


Related Tutorials/Questions & Answers:
singleton class
singleton class  What is singleton class
Java singleton
Java singleton  What is singleton
Advertisements
Singleton in Flex
Singleton in Flex  hi..... please tell me about How can you implement Singleton in Flex Application? please give me the procedure so i can implement....... Thanks
singleton program
singleton program  import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Scanner; public class Emp{ public
singleton pattern - Java Beginners
singleton pattern  how i use singleton pattern in my web aplication project.plz give an example.its urgent
Singleton & Threadsafe in struts - Struts
Singleton & Threadsafe in struts  Hi, How to implement singleton and threadsafe in struts . same in jsp and servlet. Thanks in advance
What is singleton? - Java Beginners
What is singleton?   Hi, I want to know more about the singleton in Java. Please explain me what is singleton in Java? Give me example of Singleton class. Thanks   hello, Singleton is a concept in which you
Java Singleton Pattern
In this section, you will learn about singleton pattern in Java
singleton - Java Interview Questions
singleton  what is singleton class.give one example of implementation of singleton class?  hi friend, import java.io.*; public class SingletonExam implements Serializable { public static SingletonExam single
Is Singleton Default in Struts - Struts
Is Singleton Default in Struts   Hi Friend, Is Singleton default in Struts ,or should we force any technique Thanks Prakash  Hi friend, Use of singletons is normally
J2EE Singleton Pattern - Design Pattern Tutorials
J2EE Singleton Pattern Singleton Design Pattern This design pattern governs... only one instance of object is required. The Constructor in a Singleton class is private and a public static method is used to get the Object of the Singleton
singleton class in struts - Java Beginners
singleton class in struts  hi, This balakrishna, I want to retrive data from database on first hit to home page in struts frame work
singleton class in struts - Java Beginners
singleton class in struts  hi, This balakrishna, I want to retrive data from database on first hit to home page in struts frame work
singleton class in struts - Java Beginners
singleton class in struts  hi, This balakrishna, I want to retrive data from database on first hit to home page in struts frame work
singleton class in struts - Java Beginners
singleton class in struts  hi, This balakrishna, I want to retrive data from database on first hit to home page in struts frame work
Singleton class
Singleton class       Singleton Design Pattern: The singleton design pattern allows to have one... be achieved in java by making a Singleton  class Benefits:  Singleton
What is an efficient way to implement a singleton pattern in Java?
What is an efficient way to implement a singleton pattern in Java?  What is an efficient way to implement a singleton pattern in Java
What is difference between singleton and prototype bean?
What is difference between singleton and prototype bean?  Hi, What is difference between singleton and prototype bean? Thanks
How singleton in struts - Java Interview Questions
How singleton in struts  Hi, How to implement singleton and threadsafe in struts . same in jsp and servlet. Thanks Prakash
Why we use singleton class in hibernate sessionfactory?
Why we use singleton class in hibernate sessionfactory?  Hello, Please tell me why we use singleton class in hibernate sessionfactory? hibernate sessionfactory singleton example would be very helpful. Thanks
Singleton Pattern
Singleton Pattern       Singleton Pattern:  The singleton design pattern deals with one... the singleton pattern. But take care to set the variable whenever destroying during
Java singleton program - Java Interview Questions
Java singleton program  Hi All, Can you please explain me in brife with an example how the singleton program works, i did see some documents but was not able to unerstand except one object can be used. this was a java
PHP Singleton Method
PHP Singleton Method: Many application resources are exclusive like database... to a database is exclusive. The singleton pattern is exactly the same, it uses for creating single object. To get an instance of the singleton pattern we must have
where singleton class used in java - Java Interview Questions
where singleton class used in java  where singleton classes are used in j2ee web application.can we use it for connection pooling. Thanks Prakash
Implementing a Serializable Singleton
Implementing a Serializable Singleton       In Singeton classes only one instance will be created. We...;   static SerializableSingleton singleton;  
Singleton Design Pattern
Singleton Design Pattern      ... on a class in java. The Singleton design pattern ensures that only one... to the object and allow multiple instances in the future without affecting a singleton
Creational Design Patterns
Creational Design Patterns           Singleton Pattern The singleton design... of achieving this pattern. Benefits: Singleton pattern controls access
corejava - Java Interview Questions
singleton java implementation  What is Singleton? And how can it get implemented in Java program?  Singleton is used to create only one... in the whole application.Example of Singleton Class in JAVASingleton.java
Java classes
Java classes  What is singleton pattern
core java - Java Interview Questions
core java   how can make a normal class as singleton
Design Patterns
Design Patterns  Explain the Factory Pattern, VO Pattern, DAO Pattern, and Singleton Pattern
corejava - Java Interview Questions
corejava  how can we make a narmal java class in to singleton class
java - Design concepts & design patterns
java  Q What is the disadvantage of Singleton design pattern?  Hi Friend, 1)It allows only one instance of the class. 2)If the Singleton has synchronized blocks in it, it might slow the system down as the threads
Actions Threadsafe by Default - Struts
Actions Threadsafe by Default   Hi Frieds, I am beginner in struts, Are Action classes Threadsafe by default. I heard actions are singleton , is it correct
design patterns - Java Interview Questions
design patterns  what is singleton design pattern?  Hi Friend, Please visit the following link: http://www.roseindia.net/javatutorials/J2EE_singleton_pattern.shtml Thanks
problem of static in jsp page by multiple user access
continuing my online exam project,but i have a Singleton class which i am invoking... changing my Singleton class property so that i am getting different answers by submitting n number of users. i want to this singleton class should be act
java - Java Interview Questions
java   How to form a Singleton class?  Hi Friend, Please visit the following link: http://www.roseindia.net/java/beginners/SingletonPattern.shtml Hope that it will be helpful for you. Thanks
spring - Framework
spring  what is stateless service objects?in spring it is written that singleton mode ideal for stateless service objects?can anyone give me the brief idea about
java - Java Interview Questions
java  what is a singleton class? why and where we used and give me one example  hai friend this is jagadhish A singleton is a class... a global point of access.it can be an issue if singleton class gets loaded
java - Java Interview Questions
java  can you please send complete information about singleton class... singleton class means,We have to create one object for one class. By using private... can get singleton java class.That mean that java class will allow one object
EJB 3.1 - EJB Interfaces are Optional
. The Singleton Beans A new feature of Singleton Beans is added in EJB 3.1... maintains a single shared instance of an EJB 3.1 Singleton that can cache state
Java News and Releases
.   The Singleton Beans A new feature of Singleton Beans... container maintains a single shared instance of an EJB 3.1 Singleton that can
J2EE design patterns - Design concepts & design patterns
J2EE design patterns  Hi all, could any one send me design patterns links. its very utgent. thanks, lakshminarayana.  Hi Friend, For J2EE Singleton Pattern,visit the following link: http
OOPs - Java Interview Questions
singleton pattern in our application
Design Pattern in flex
Design Pattern in flex  Hi.... I want to know about What design patterns have you used? in Actionscript and java? please give me the name of this design pattern... Thanks   Ans: Singleton design pattern is used
java - JDBC
singleton pattern(singleton class) so that i can implement in my project.i need to implement singleton class in the below code.please help me out public... above class object  Hi friend, The Singleton design pattern ensures
Spring Bean Scope Default
singleton, prototype, request, session, global session) supported by the spring framework. Apart of these five the Spring?s core scope is singleton and prototype. The singleton return a single bean instance per spring IoC container
Struts
Struts  why in Struts ActionServlet made as a singleton what is the specific reason how it useful in the webapplication development?   Basically in Struts we have only Two types of Action classes. 1.BaseActions
java - Design concepts & design patterns
java  what is singleton design pattern?Give implementation of singleton design pattern? what is factory design pattern?and give its implementation.   Hi friend, class Singleton{ public static void main
 

 

 

DMCA.com