I am a beginner in java and my code to generate a random sums throws a strange exception...
public void randomRekensom(int n)
{
switch(n) {
case 1: this.max = 100;
break;
case 2: this.max = 150;
break;
case 3: this.max = 200;
break;
}
getal1= (int) Math.sqrt(max);
getal2= (int) Math.sqrt(max);
operator=ThreadLocalRandom.current().nextInt(1, 4 + 1);
switch(operator) {
case 1: antwoord=(this.getal1+this.getal2);
operatorTeken=" + ";
break;
case 2: antwoord=(this.getal1-this.getal2);
operatorTeken=" - ";
break;
case 3: antwoord=(this.getal1/this.getal2);
operatorTeken=" / ";
break;
case 4: antwoord=(this.getal1*this.getal2);
operatorTeken=" * ";
break;
}
}
Maybe it's because I've been staring too much at my screen today but I don't know why I'm getting this error.
Thanks in advance!