I don't understand what is the different of static void, protected, or void in method.
I don't know when can I use the static void, or void?
for example :
public class C extends JFrame {
public C() {
initComponents();
}
protected void initComponents() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //i dont understand
setSize(400, 400);
JTextArea textArea = new JTextArea();
textArea.setText("Press the mouse button...");
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new C().setVisible(true);
}
});
}
}
why can we use this 'setDefaultCloseOperation' this time,without create an object first.
may be someone can explain to me?
Thank you...