When creating a swing window why does:
class ControlWindow extends JFrame
{
public void ControlWindow()
{
super("Hello");
setSize(300,100);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
}
}
...produce the message 'call to super must be first statement in constructor' when compiling?
If you remove the 'void' keyword from the ControlWindow constructor it compiles fine. I thought a return type was compulsory (or void) why when you have the super() keyword it doesn't compile with 'void'?
class ControlWindow extends JFrame
{
public void ControlWindow()
{
super("Hello");
setSize(300,100);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
}
}
...produce the message 'call to super must be first statement in constructor' when compiling?
If you remove the 'void' keyword from the ControlWindow constructor it compiles fine. I thought a return type was compulsory (or void) why when you have the super() keyword it doesn't compile with 'void'?