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

Popular posts from this blog

python - jinja2: TemplateSyntaxError: expected token ',', got 'string' -

Qt4: how to send QString inside a struct via QSharedMemory -

node.js - NodeJS remote terminal to Dropbear OpenWRT-Server -