Wednesday, July 25, 2007

JAVA singleton class

Code below, you can make singlton class(has only one object).
public class AppFunction {
private static AppFunction af;
private AppFunction() {
}
public static AppFunction getInstance(){
if(af!=null){
return af;
} else{
af = new AppFunction();
return af;
}
}
}

No comments: