I'm running the below applet. In it, the moment I add the constructor (even empty), the applet throws a runtime exception:
MainFrame.class can't be instantiated, java.lang.InstantiationException
If I remove the constructor, no exception in thrown. Can't I have a constructor present in an applet?
public class MainFrame extends JApplet implements WindowListener, ActionListener {
public void init()
{
System.out.println("Applet Step1");
String[] args = null;
createAndShowGUI(args);
}
private static void createAndShowGUI(String[] args) { /*code*/ }
public MainFrame(final String[] args) {}
}
You need to add a default constructor too...
public MainFrame() {}