Note:
You cannot print parameter other than String in drawString function of Graphics.
Code:
import java.applet.Applet;
import java.awt.Graphics;
import java.awt.Color;
/*
<applet code="Parameter" height=300 width=200>
<param name="Coding" value="100" />
</applet>
*/
public class Parameter extends Applet
{
String name;
public void init()
{
setBackground(Color.red);
name = getParameter("Coding");
}
public void paint(Graphics g)
{
g.drawString("Coding Atharva",25,100);
g.drawString(name,20,10);
}
}
You cannot print parameter other than String in drawString function of Graphics.
Code:
import java.applet.Applet;
import java.awt.Graphics;
import java.awt.Color;
/*
<applet code="Parameter" height=300 width=200>
<param name="Coding" value="100" />
</applet>
*/
public class Parameter extends Applet
{
String name;
public void init()
{
setBackground(Color.red);
name = getParameter("Coding");
}
public void paint(Graphics g)
{
g.drawString("Coding Atharva",25,100);
g.drawString(name,20,10);
}
}