私はすべてのプログラミングの割り当てを最初に日食で行い、その後パテに入れて教師に提出します。Eclipseでは、メソッドの1つにこの奇妙なエラーがあります。
「トークンの構文エラー、誤って配置された構成」と表示されます。
public static int factorial(int iVal, boolean DEBUG)
{
int result;
// Defensive programming
if(iVal <= 0)
{
System.out.println("Error: iVal cannot be a negative number!");
System.exit(0);
}
// Calculate result
int factor = iVal;
int counter = iVal - 1;
for(int i = counter; i > 1; i--)
{
if(DEBUG = true)
{
System.out.println("DEBUG");
System.out.println(" Finding the factorial of " + factor);
System.out.println(" Currently working on " + i);
System.out.println(" With an intermediate result of" + iVal);
}
iVal *= i;
}
result = iVal;
// Return result
return result;
} // End of factorial method
次の行にエラーがあります。
System.out.println(" Currently working on " + i);
何か案は?