title: StringIndexOutOfBoundsException in Scanner
body: <p>I want to scanner console and proceed what user input as a string, then scanner file which name is that string. </p>
  
  <p><code>public static void main(String[] args) throws FileNotFoundException  {
        Scanner console = new Scanner(System.in);
        intro();
        System.out.print("input file name?");
        String inputfile = console.next();
        Scanner file = new Scanner(new File(inputfile));
     }
  </code>
  But when I entered file name such as personality.txt, java keeps telling me Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 9. How can I fix this?</p>