How to load ImageIcon in aJava applet

// To load an ImageIcon in an applet, use this code:
ImageIcon img1 = new ImageIcon(getClass().getResource("a.jpg"));

// The following code doesn't work in an applet
ImageIcon img2 = new ImageIcon("a.jpg");

No comments: