Java

Fortune.java:16: error: incompatible types: int cannot be converted to boolean
if (fortune=0) {
^
1 error

= is the assignment operator, not a comparison operator. So now we have an integer, where we expect a boolean (the result of a comparison)

What’s thé sollotion

using equality/equal to operator:

https://docs.oracle.com/javase/tutorial/java/nutsandbolts/op2.html

thank you very muchhh

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.