问题是程序在循环部分的末尾死了,但是所有代码都还可以,所以我不知道如何解决
package parcial;
import javax.swing.*;
import java.util.*;
public class Parcial {
public static void main(String[] args) {
double players[] = new double[6];
Random rnd = new Random();
double suma = 0, num1, num2;
int i;
for (i = 0; i < 6; i++) {
num1 = rnd.nextInt(12) + 1;
num2 = rnd.nextInt(12) + 1;
if (num1 == 10 || num1 == 11 || num1 == 12) {
num1 = 0.5;
suma = num1 + num2;
} else if (num2 == 10 || num2 == 11 || num2 == 12) {
num2 = 0.5;
suma = num1 + num2;
} else {
suma = num1 + num2;
}
players[i] = suma;
System.out.println(players[i]);
}
if (players[0] > players[i]) {
JOptionPane.showMessageDialog(null, "Gana 1");
} else if (players[1] > players[i]) {
JOptionPane.showMessageDialog(null, "Gana 2");
} else if (players[2] > players[i]) {
JOptionPane.showMessageDialog(null, "Gana 3");
} else if (players[3] > players[i]) {
JOptionPane.showMessageDialog(null, "Gana 4");
} else if (players[4] > players[i]) {
JOptionPane.showMessageDialog(null, "Gana 5");
} else if (players[5] > players[i]) {
JOptionPane.showMessageDialog(null, "Gana 6");
}
}
}