String[] lvl15={"Twin", "Flank Guard", "Sniper", "Machine Gun"};
String[] lvl30={"", "Triple Shot", "Quad Tank", "Twin Flank", "Tri-Angle", "Assasin", "Overseer", "Hunter", "Destroyer", "Gunner", ""};
String[] lvl45={"Triplet", "Penta Shot", "Octo Tank", "Triple Twin", "Overlord", "Necromancer"};
int index15;
int index30;
int index45;
index15=rand.nextInt(lvl15.length);
switch(index15){
case 0: class15="Twin";
break;
case 1: class15="Flank Guard";
break;
case 2: class15="Sniper";
break;
case 3: class15="Machine Gun";
break;
}
if(class15=="Twin"){index30=rand.nextInt(3)+1; class30=lvl30[index30];}
if(class15=="Flank Guard"){index30=rand.nextInt(4)+2; class30=lvl30[index30];}
if(class15=="Sniper"){index30=rand.nextInt(7)+5; class30=lvl30[index30];}
if(class15=="Machine Gun"){index30=rand.nextInt(9)+8; class30=lvl30[index30];}
There is my code. For some reason it comes up with this error sometimes
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 11
at diepiogen.DiepIOGen.main(DiepIOGen.java:54)
C:\Users\******\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 0 seconds)
So can someone please help because it seems like this is for no reason by the way line 54 is if(class15=="Sniper"){index30=rand.nextInt(7)+5; class30=lvl30[index30];}
And now im just adding filler because otherwise I cant post this.