How to make this Java 'Hangman' work?
<p>Im doing a java homework program where you have 20 random words and it randomly chooses 1 of the twenty, after that you have to guess the word hangman style (with 10 lives), and assuming the word is Telephone it would first appear like _ _ _ _ _ _ _ _ _ and say you enter in a guess "e", it would become _ e _ e _ _ _ _ e and then guess "t", t e _ e _ _ _ _ e, this is suspose to be using simple console programming. From what i have done so far the program runs once and won't work a second time if i loop it again.</p>

<p>Here's the code i have done so far (the stuff i have been taught in java doesn't extend past this by much, so if you know how to fix this program using new commands please explain what the command does, please and thank you :) )</p>

<pre><code>import hsa.*;
import java.util.Random;

public class Whatistheword {
    public static void main(String[] args){
        Console con = new Console ();


        String mword="";
        String guess="";
        Random r = new Random();
        int length;
        int count=0;
        int intx1=0;
        int intx2=1;
        String check;
        int letter=0;
        int life = 10;
        int check2 = 0;

        con.println ("Welcome to the 'What is the Word?' Game");
        pause (1000);

        // Array of 20 words &amp; chooses one of the twenty
        String[] listOfWords = {"IpodTouch","Blackberry","Apple","Samsung"}
        int randint = r.nextInt(listOfWords.length);
        mword = listOfWords[randint];

        // so i know what the word is to test
        con.println("The Random word is: "+mword);
        length = mword.length();
        con.println (mword);
        con.println (length);


        con.println ("Guess a letter for the word!");
        guess = con.readLine();
        // runs to check letters individually
        while (count != length){
            count = count + 1;
            check = mword.substring(intx1,intx2);
            intx1 = intx1 + 1;
            intx2 = intx2 + 1;
            if (guess.equalsIgnoreCase(check)){
                letter = letter + 1;
                con.print (guess);
            // prints this if letter wasnt guessed
            }else { 
                con.print (" _ "); 
            }
        }
    }

    public static void pause(int intMS){
        try{ 
            Thread.sleep(intMS);
        }catch(InterruptedException e){
        }
    }
}
</code></pre>
