IF statement _ problem !!!

Hi everyone,

can anyone tell me what is wrong with the following statement :

if ( (side1 * side1) + (side2 * side2) = (hypotenuse * hypotenuse) ) {

output.append(side1 + "\t" + side2 + "\t" + hypotenuse + "\n");

}

It says : Invalid left hand side of assignment. Arrow pointed at sign + .

Thanks a lot,Isaac.

[364 byte] By [IsaacR] at [2007-9-26 1:54:13]
# 1
Hi, You should use ==. "=" is only for assignment. "==" is for comparision.--lichu
lichudang at 2007-6-29 3:06:23 > top of Java-index,Archived Forums,Java Programming...
# 2

> if ( (side1 * side1) + (side2 * side2) = (hypotenuse *

> hypotenuse) ) {

> output.append(side1 + "\t" + side2 + "\t" +

> "\t" + hypotenuse + "\n");

> }

>

> It says : Invalid left hand side of assignment. Arrow

> pointed at sign + .

you should also use the open and close parenthesis so that the compiler will not get confused, such as this:

if ( ((side1 * side1) + (side2 * side2)) == (hypotenuse *

hypotenuse) )

and also like lichu said: use == instead of =.

v_caspillan at 2007-6-29 3:06:23 > top of Java-index,Archived Forums,Java Programming...
# 3
use (==) not (=) for if condition
samerdb at 2007-6-29 3:06:23 > top of Java-index,Archived Forums,Java Programming...