Я выполняю все свои задания по программированию в Eclipse, прежде чем положить их в шпаклевку и передать их нашему учителю.В затмении у меня есть эта странная ошибка в одном из моих методов.
говорит: «Синтаксическая ошибка на токене (ах), неуместные конструкции (и).»
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);
Есть идеи?