當我嘗試編譯這段代碼時,我總是想出編譯錯誤。代碼如下。編譯錯誤Java
import java.util.Scanner;
public class BaseballPitcher
{
private final int MAX_GAMES = 15;
private gamesPitched[];
private int totalGames;
private int totalRuns;
private float totalInnings;
private double ERA;
public BaseballPitcher()
{
gamesPitched = new GamePitched[];
}
public void inputGameData()
{
Scanner input = new Scanner (System.in);
do
{
System.out.printf ("How many games will you enter (up to %d): ", MAX_GAMES);
totalGames = input.nextInt();
if (totalGames <= 0 || totalGames > MAX_GAMES)
{
System.out.printf ("Error: You may only enter up to %d games" + " - Please try again\n\n", MAX_GAMES);
}
} while (totalGames <= 0 || totalGames > MAX_GAMES);
for (int x = 0, x < totalGames, x++)
{
gamesPitched[x] = new GamePitched();
gamesPitched[x].inputGame();
}
}
}
我收到編譯錯誤是:
[Please list your compile error or errors].
爲什麼會收到編譯錯誤?
你爲什麼要告訴我們你的錯誤,但沒有告訴我們它們是什麼?看起來你只是希望我們在不付出任何努力的情況下解決它。 –
您如何要求限制需要應用多少變更才能獲得工作代碼... –