title: Scanning, spliting and assigning values from a text file
body: <p>I'm having trouble scanning a given file for certain words and assigning them to variables, so far I've chosen to use Scanner over BufferedReader because It's more familiar. I'm given a text file and this particular part I'm trying to read the first two words of each line (potentially unlimited lines) and maybe add them to an array of sorts. This is what I have: </p>
  
  <pre><code>    File file = new File("example.txt");
      Scanner sc = new Scanner(file);
  
      while (sc.hasNextLine()) {
          String line = sc.nextLine();
          String[] ary = line.split(",");
  </code></pre>
  
  <p>I know It' a fair distance off, however I'm new to coding and cannot get past this wall...</p>
  
  <p>An example input would be... </p>
  
  <pre><code>ExampleA ExampleAA, &lt;other items seperated by ","&gt;
  ExampleB ExampleBB, &lt;other items spereated by ","&gt;
  ...
  </code></pre>
  
  <p>and the proposed output</p>
  
  <pre><code>VariableA = ExampleA ExampleAA
  VariableB = ExampleB ExampleBB
  ...
  </code></pre>