I have one class (class util) for generating password(it has only one public static method ). Here two ways are : To make it abstract so no one can create its instance
public abstract class PasswordGenerator {
public static String randomstring(int lo, int hi) {
// Some logic , doesn't matter
return "";
}
}
or to make its constructor private
. So What's the best approach to do that ?
public class PasswordGenerator {
private PasswordGenerator() {
}
public static String randomstring(int lo, int hi) {
// Some logic , doesn't matter
return "";
}
}
So What's the best approach to do that ?