title: Why am I getting a outofbounds error?
body: <p>I keep getting a Exception in thread "main" </p>
  
  <blockquote>
    <p>java.lang.StringIndexOutOfBoundsException: String index out of range:
    5     at java.lang.String.charAt(String.java:658)     at
    hackman.NewClass.startGame(NewClass.java:31)  at
    hackman.Decipher.main(Decipher.java:65)</p>
  </blockquote>
  
  <pre><code>public NewClass()
  {
  
  }
  
  public char[] startGame()
  {
      char[] virusB = new char[100];
      String virus;
      Scanner scan = new Scanner(System.in);
      System.out.print("Enter your message");
      virus = scan.nextLine();
      for(int i=0; i&lt;virusB.length+1; i++)
      {                   
          virusB[i]= virus.charAt(i);
      }  
      virusA = virusB;
  
      return virusA;             
  }
  </code></pre>