Mosch
Reeks of fish
So we have quite some coders here, maybe one of you can help me with my problem....
Here are my Variables:
CODE
int a[] = new int[10];
String s[] = new String[10];
Random die = new Random();
And here are two "fors":
CODE
for ( int index = 1; index <= 10; index++ )
{
a[index] = die.nextInt(6);
a[index]++;
s[index] = String.valueOf(a[index]);
}
for ( int index = 1; index <= 10; index++ )
{
aGUI.klChoice.add(s[index]);
aGUI.inChoice.add(s[index]);
aGUI.chChoice.add(s[index]);
aGUI.diChoice.add(s[index]);
aGUI.skChoice.add(s[index]);
aGUI.koChoice.add(s[index]);
aGUI.ffChoice.add(s[index]);
aGUI.geChoice.add(s[index]);
aGUI.kkChoice.add(s[index]);
aGUI.wnChoice.add(s[index]);
}
They both seem to produce an infinite loop - or at least somehow make my program stop. I tried to catch a NullPointerException, but it came up with nothing. Now I have not programmed in Java for two years, but I really don't see the problem.
Here are my Variables:
CODE
int a[] = new int[10];
String s[] = new String[10];
Random die = new Random();
And here are two "fors":
CODE
for ( int index = 1; index <= 10; index++ )
{
a[index] = die.nextInt(6);
a[index]++;
s[index] = String.valueOf(a[index]);
}
for ( int index = 1; index <= 10; index++ )
{
aGUI.klChoice.add(s[index]);
aGUI.inChoice.add(s[index]);
aGUI.chChoice.add(s[index]);
aGUI.diChoice.add(s[index]);
aGUI.skChoice.add(s[index]);
aGUI.koChoice.add(s[index]);
aGUI.ffChoice.add(s[index]);
aGUI.geChoice.add(s[index]);
aGUI.kkChoice.add(s[index]);
aGUI.wnChoice.add(s[index]);
}
They both seem to produce an infinite loop - or at least somehow make my program stop. I tried to catch a NullPointerException, but it came up with nothing. Now I have not programmed in Java for two years, but I really don't see the problem.