Is it neccessary to make an
applet subclass as public ?
I am asking this because I have this following simple applet code :
It executes normally.
However when I remove the public modifier from the class the applet window does open but display is not performed, status bar shows message Applet not initialized and exception is thrown on closing the window.
Following exception is thrown:
D:\Education\Java\JavaStudyRoom\Applets>appletviewer xyz.html
load: appExample is not public or has no public constructor.
java.lang.IllegalAccessException: Class sun.applet.AppletPanel can not access a
member of class appExample with modifiers ""
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
at java.lang.Class.newInstance0(Class.java:349)
at java.lang.Class.newInstance(Class.java:308)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:785)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:714)
at sun.applet.AppletPanel.run(AppletPanel.java:368)
at java.lang.Thread.run(Thread.java:619)
Thanks for clearing my doubt.