Hey I have this question in my assignment and I can't see why it would compile, so confused...any help with this question?
The following code excerpt is valid Java
if (b = check ()){
System.out.println("All is OK.");
}
What can you infer about 'check()' and 'b'?
The syntax for an if-expression is if(boolean expression).
However
b = check() appears to be an assignment expression. Explain why
if (b = check()) does in fact compile.
Would appreciate any help with this guys it has got me stumped.