title: Splitting a Scanner Input Into Strings
body: <p>I've been looking for an answer to this for a while, but for some reason, none of them seem to work.</p>
  
  <pre><code>public static void main(String[] args) {
  
      Scanner scanner = new Scanner(System.in);
  
      System.out.println("Please enter full name (last, first)");
      String[] personalInfo = scanner.next().split(", ");
      String firstName = personalInfo[1];
      String lastName = personalInfo[0];
  
      System.out.println("Your info: " +  firstName + " " + lastName);
  </code></pre>
  
  <p>There is my code. I'm basically trying to obtain the personal info, which would be the first and last name. I want to split the first and last name into 2 different strings, but whenever I try to print this, I get the error: </p>
  
  <blockquote>
    <p>Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 1  > out of bounds for length 1
    at Fines.main(Fines.java:11)</p>
  </blockquote>
  
  <p>I'm confused because I even started the array with 0 like I was supposed to.. I just don't understand what is going incorrectly.</p>
  
  <p>Please give me a hand - thanks in advance!</p>