/* <applet code = "myname" width = 250 height = 200 > </applet> */
public class myname extends Applet
public void paint(Graphics g)
g.drawString("Your Name Here",80,80);
Here, in output applet, background color is red. If your want to change the background color to another color, just change code ‘setBackground(Color.red)’ to ‘setBackground(Color.< another color name >)’.
Here text color is blue. If your want to change the color of text to another color, just change code ‘setForeground(Color.blue)’ to ‘setForeground(Color.< another color name >)’.
Type your name instead of ‘Your Name Here’ in your code.
And here class name is ‘myname’. So you should save your program in name as ‘myname.java’.
Output for above code:
Learn how to compile a java program here.
Learn how to make, compile and run a java applet here.