Java Applet Program to Count String Length

Write a Java Applet Program to count given string length.



Source Code
import java.awt.Graphics;

public class CharCountParam extends Applet{

	String uname="", msg;
	int length;
	
	public void init() 
	{
		
		uname = getParameter("Username");
		length = uname.length();
				
		uname = "Hello " + uname;
		msg = "Length = " + length;
 	}
	
	public void paint(Graphics g)
	{
		g.drawString(uname,50,50);
		g.drawString(msg, 50, 90);
	}
}
/* 
<applet code="CharCountParam" width=200 height=200>
<param name="Username" value="RAHUL">
</applet>
*/
Output