Java Applet Example

import awt.*;

import java.io.*;

import net.www.html.*;

import browser.*;

import browser.audio.*;

/**

* @author Patrick Chan

* @version 1.0

*/

class Hangman extends Applet implements Runnable {

/* This is the maximum number of incorrect guesses. */

final int maxTries = 5;

/* This is the maximum length of a secret word. */

final int maxWordLen = 20;

/* This buffer holds the letters in the secret word. */

char secretWord[];

/* This is the length of the secret word. */

int secretWordLen;

/* This buffer holds the letters which the user typed

but don't appear in the secret word. */

char wrongLetters[];

/* This is the current number of incorrect guesses. */

int wrongLettersCount;

Java Applet Example

Hang Duke

...

Hangman.java

javac Hangman.java

Previous slide Next slide Back to the first slide View Graphic Version

Notes: