Introduction to AWT and Applets · Introduction to Java Programming

Applet Parameters

Watch lectures

Applet Parameters

1. What Are Parameters? (beginner)

Params = settings from HTML to applet (no recompile to change name/color!). Like function args, but from web page! <param name="msg" value="hi"> → getParameter("msg") → "hi"!

2. Code — HTML + Java (exam pair!)

<!-- page.html -->
<applet code="Hi.class" width="300" height="100">
  <param name="msg" value="Hello Web!">
  <param name="size" value="20">
</applet>

3. Rules (traps!)

  • ALL params are String (parse numbers yourself!).
  • Missing → null (check! else NPE!).
  • getParameter in init() (once! not paint!).

4. Modern Twin (viva!)

Applets dead, but SAME idea lives: command args (args[]), properties (-Dmsg=hi), env vars, config files!

5. Exam Points

  • HTML + getParameter program — 5-7 marks, frequent.
  • String-only + null-check — 3 marks, frequent.
Student FinanceWeb Platform

Pocketly — Personal Finance for Students

Keep your hostel and college expenses under control. Track accounts, log spending in seconds, and stay within your monthly budget.

← All Introduction to Java Programming modules