while using an if statement i keep getting "- Syntax error on token ";", { expected after this token" error message. im not sure why, I am somewhat new to java.this is a java fx project but i have any connections to the controller yet.
ive tried adding a else statement and changing the variables. ive also tried to make the declaration and the modification separate.
package application;
public class Mathprocess {
int numberOne = 15;
int numberTwo = 5;
int answerNumbers;
int ansSubtract = 0;
int ansDivide = 0;
int ansMultiply = 0;
int ansAddition = 0;
//Question 1
ansAddition = numberOne + numberTwo;
String questionOne = numberOne + " + " + numberTwo +" = ";
//Question 2
ansMultiply = numberOne * numberTwo;
String questionTwo = numberOne + " * " + numberTwo +" = ";
//Question 3
ansDivide = numberOne / numberTwo;
//Question 4
ansSubtract = numberOne - numberTwo;
// error happens here
if (ansAddition > 0) {
answerNumbers = ansAddition;
}
}
the expected result is a clean program with no errors.
Aucun commentaire:
Enregistrer un commentaire