How to read an Applet Parameters in Java?

Below java code shows how to read applet parameters:

 * Created on 07-2011 Copyright(c) All Rights Reserved.

import java.applet.Applet;
import java.awt.*;

 * This class shoes you code snippet for getting or reading the Parameter value.
 * Created by Vigilance India.
 * User:
 * Date: Jul 31, 2011
public class AppletParameter extends Applet {
    private String param="";
    public void init(){
        //In this init() method of Applet we will be reading the parameter
        //from applet tag definition in the HTML file
        param = getParameter("param");

    public void paint(Graphics g) {
        g.drawString("Hi here is your parameter " + param, 0, 0);
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  <title>Parameterized Applet</title>
    <applet code="" 
            height="150" width="350">
        <param name="param" value="Parameter Value" />

Please Post Your Comments & Reviews

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.