I do all my programming assignments in eclipse first before putting them in putty and submitting them to our teacher. In eclipse, I have this strange error in one of my methods.
it says "Syntax error on token(s), misplaced construct(s)."
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
It has the error placed on the line consisting of
System.out.println(" Currently working on " + i);
Any ideas?