// Java packages
import java.awt.Graphics; // import class Graphics
import javax.swing.JApplet; // import class JApplet
public class WelcomeApplet2 extends JApplet {
// draw text on applet’s background
public void paint( Graphics g )
{
// call superclass version of method paint
super.paint( g );
// draw two Strings at different locations
g.drawString( "Welcome to", 25, 25 );
g.drawString( "Java Programming!", 25, 40 );
} // end method paint
} // end class WelcomeApplet2
/* when i compfile javac WelcomeApplet2.java its fine it make the class file then run the class file
java WelcomeApplet2
it gives this message
Exception in thread "main" java.lang.NoSuchMethodError: main
*/


Reply With Quote
and thanks for posting your solution.


Bookmarks