reading text file storing it into an array
<p>The following code compiles in jgrasp, but it reads out <code>You null null</code>. I can't figure out how to get my text files to read and store into their arrays?</p>

<pre><code>import java.io.*; 
import java.util.Scanner;
import java.util.Random;
public class InsultGenerator {

//randomly picks an adjective and a noun from a list of 10 random nouns and adjectives
//it then creates a random insult using one adjective and one noun
public static void main (String [] args)throws IOException
{
    String[]adjectives = new String [10];
    String[]nouns = new String [10];
    int size = readFileIntoArray (adjectives);
    int size2 = readFileIntoArray2 (nouns);
        String adjective = getAdjective(adjectives, size);
    String noun = getNoun(nouns, size2);
    printResults(adjectives, nouns, adjective, noun );
}

public static int readFileIntoArray (String[] adjectives)throws IOException
{  
    Scanner fileScan= new Scanner("adjectives.txt");
    int count = 0;  
    while (fileScan.hasNext()) 
    {
        adjectives[count]=fileScan.nextLine();
        count++;
    }
    return count;
}
public static int readFileIntoArray2(String[] nouns)throws IOException
{
    Scanner fileScan= new Scanner("nouns.txt");
    int count = 0;  

    while (fileScan.hasNextLine()) 
    {
        nouns[count]=fileScan.nextLine();
        count++;
    }   
    return count;
}
public static String getAdjective(String [] adjectives, int size)
{
    Random random = new Random();
    String adjective = "";
    int count=0;
    while (count &lt; size)
    {
        adjective = adjectives[random.nextInt(count)]; 
        count ++;
    }
    return adjective;
}
public static String getNoun(String[] nouns, int size2)
{
    Random random = new Random();
    String noun = "";
    int count=0;
    while (count &lt; size2)
    {
        noun = nouns[random.nextInt(count)]; 
        count ++;
    }
    return noun;
}
public static void printResults(String[] adjectives, String[] nouns, String adjective, String noun) 
{
    System.out.println("You " + adjective + " " + noun);
}
}
</code></pre>

<p>The teacher wants us to use run argument and put each text file in there. So my run argument says <code>adjectives.txt</code>, <code>nouns.txt</code> (each of those files is a list of 10 nouns or adjectives).<br>
I want to store them into arrays then get the program to randomly pick one from each list and make a statement.</p>
