Opções de Entrada:

        Um applet é normalmente invocado através de um comando <APPLET>, presente numa página HTML.
        Esse comando apresenta diversas opções, entre as quais passar parâmetros como argumento ao applet.
    Assim, nosso applet foi projetado de modo a comportar essa passagem de parâmetros, como no caso abaixo:

<APPLET code="PC.class" WIDTH="350" HEIGHT="105">
                <PARAM NAME=buflenght VALUE="10">
                <PARAM NAME=psleep VALUE="400">
                <PARAM NAME=csleep VALUE="400">
                <PARAM NAME=pamount VALUE="1">
                <PARAM NAME=camount VALUE="1">
                <PARAM NAME=sleeptime VALUE="400">
</APPLET>

Esses seis parâmetros representam as seguintes entradas:


Esses parâmetros são lidos na classe do applet, PC, no seguinte trecho:

// Leitura dos parâmetros passados pelo tag <APPLET>

try {
    N = new Integer (getParameter("buflenght"));
} catch (Exception e) {
    N = new Integer ("10");
}

try {
    csleep = new Integer (getParameter("csleep"));
} catch (Exception e) {
    csleep = new Integer ("700");
}

try {
    psleep = new Integer (getParameter("psleep"));
} catch (Exception e) {
    psleep = new Integer ("700");
}

try {
    pamount = new Integer (getParameter("pamount"));
} catch (Exception e) {
    pamount = new Integer ("1");
}

try {
    camount = new Integer (getParameter("camount"));
} catch (Exception e) {
    camount = new Integer ("1");
}

try {
    sleeptime = new Integer (getParameter("sleeptime"));
} catch (Exception e) {
    sleeptime = new Integer ("400");
}

        O tratamento de exceções (try-catch) verifica a correta conversão dos argumentos, e se houver alguma anormalidade ou valores inválidos, são setados valores default.