Singleton Design Pattern for Utility Clases
public class DateUtility{
private static DateUtility instance;
public static DateUtility getInstance() {
synchronized (DateUtility.class) {
if (instance == null) {
instance = new DateUtility();
}
}
return instance;
}
public String convertDateToString(Date date) {
.......................................
}
Usage: DateUtility.getInstance().convertDateToString();
Comments
Post a Comment