I am getting the invalid assignment error when trying to parse two strings and them perform mathematical operations on them :S
the error is in this line,
IfirstValue+IfirstValue;
Here is the complete code,
firstValue = 34;
secondValue = 10;
IfirstValue = Integer.parseInt(firstValue);
IsecondValue = Integer.parseInt(secondValue);
if (operator == 3){
IfirstValue+IfirstValue;
}
I tried replacing ‘+’ by ‘-‘ , ‘/’ , ‘*’ but the error remains same :S
(operator is input from the user)
please explain why it is happening.
Because you don’t assign the result of the expression. Try:
or
Also, please avoid starting variable names with capital letters, it violates Java’s coding convention.