How do I get my Hangman Java file to read a random word in from a .txt file?
<pre><code>char hangman[];
Scanner sc = new Scanner( System.in);
Random r = new Random();
File input = new File("ComputerText.txt").useDelimiter(",");
Scanner sc = new Scanner(input);
String words;
</code></pre>

<p>I want to read in a set of words from a .txt file and have the program select a random word to use in the hangman game.</p>

<p>The below code is for when we get the .txt file to be read inside the code. 
We want to use three different .txt files with a different category each and have the user pick which category they want their word from.</p>

<pre><code>//while(decision==1){word=computerWord;}
if ( decision == 1)
{
word=computerWord;
}
else if ( decision == 2)
{
word = countryWord;
}
else if (decision == 3)
{
word = fruitWord;
}
else
{
System.out.println("error, try again");
}
</code></pre>