java - netbeans warning: "Utility class without constructor" -
i have convenience, utility class displaying error messages in swing app:
public class errormessage { public static void error(component parent, string message){ joptionpane.showmessagedialog(parent, message, "error", joptionpane.error_message); } }
however, netbeans (not compiler) gives warning:
utility class without constructor
i know can turn off warning, i'm wondering: point of warning? alt+enter shows me netbeans wants me create private constructor:
private errormessage() { }
why?
as asking question, answer became obvious:
so no 1 accidentally creates instance of errormessage
class. because constructor private, cannot instantiated. great hint, realize it's for.
Comments
Post a Comment