ArrayIndexOutOfBounds

Discussion in 'Plugin Development' started by colony88, Jan 15, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    colony88

    Hi, I got this error:

    Code:
    java.lang.ArrayIndexOutOfBoundsException: 1
    at me.cedi.inviteReward.InviteReward.onEnable(InviteReward.java:47)
    this is my code:

    Code:java
    1. while(s.hasNext()){
    2. String string = s.next();
    3. String[] stra = string.replaceAll(":", "").split(" ");
    4. while(i <= stra.length){
    5. String inv = stra[i];
    6. invited.put(inv, stra[0]);
    7. ++i;
    8. }
    9. }
    10. [/i]

    What did I do wrong?
     
  2. Offline

    camyono

    while(i <= stra.length){

    to

    while(i < stra.length){

    "i" will start at 0 i think
     
  3. Offline

    gomeow

    Try this:
    String inv = stra[i-1];
     
  4. Offline

    fireblast709

    while(i < stra.length)
     
Thread Status:
Not open for further replies.

Share This Page