此代碼有什麼問題?它說cannot convert from String to int
,但我已經轉換它。Java:無法將字符串轉換爲int
public static void main(String[] args) {
String x = JOptionPane.showInputDialog(null, "Hur många värden haver du?");
int i = Integer.parseInt(x);
for (int y = 0; i >= y; y++) {
String z = JOptionPane.showInputDialog(null, "Skriv in värdet");
int sum = Integer.parseInt(z);
sum = (sum + z);
}
}
不應該把這個'i> y'設爲'y
@Karan Mer如果你寫'i> y'或者'y kai