Sandeep
BAN USERpublic class Test {
private Test _instance = null;
private Test(){
}
public Test getInstance(){
if(_instance == null)
return new Test();
return _instance;
}
}
Singleton classes lets you have only once instance of the class. For example, in android application development the same activity class has to be used for user interaction thus a singleton class is used.
public class Test {
private Test _instance = null;
private Test(){
}
public Test getInstance(){
if(_instance == null)
return new Test();
return _instance;
}
}
Singleton classes lets you have only once instance of the class. For example, in android application development the same activity class has to be used for user interaction thus a singleton class is used.
- Sandeep March 13, 2015