title: How to read from txt file line and print arrays of strings and integers
body: <p>I am reading from a text file a specific line defined by a user input with <code>if(nameLine.contains(inputFileName)){</code> I am trying to print an array of names and array of numbers from that line. Could anyone help me out with how to do so? Do I have to create 2 different methods or can I do it all in main? I only know how to work with one <code>Array</code> in one code with <code>while loop</code>, but I am not sure how to have it all combined. Thank you for your help!</p>
  
  <blockquote>
    <p>My code is not finished, but this is how it looks so far</p>
  </blockquote>
  
  <pre><code>public static void main(String[] args) throws IOException {
  
      Scanner in = new Scanner(System.in);
      System.out.print("Enter the State name: ");
      String inputFileName = in.next();
      String names = "pplnames17.txt";
  
      List&lt;String&gt; namearr = new ArrayList&lt;String&gt;();
  
      File namesFile = new File(names);
      Scanner stateSearch = new Scanner (namesFile);
  
      //print title
      String line0 = Files.readAllLines(Paths.get("pplnames17.txt")).get(0);
      System.out.printf("%s in %s", line0, inputFileName);
  
      while(stateSearch.hasNextLine()){
          String nameLine = stateSearch.nextLine();
          if(nameLine.contains(inputFileName)){
              System.out.printf("\n%s",nameLine);
          }
      }
  </code></pre>
  
  <blockquote>
    <p>This is a partial of my <code>Array</code> code for <code>String</code>, which I had it after a <code>while loop</code></p>
  </blockquote>
  
  <pre><code>    while(stateSearch.hasNextLine()){
      namearr.add(stateSearch.nextLine());
  }
  String[] arr = namearr.toArray(new String [0]);
  System.out.println(arr);
  </code></pre>