I have a method that does a lot of checking and computation and returns a custom class, returnMessage. returnMessage has 2 booleans and a String. What I want to do is run this method in a while loop from my main class and have access to the returnMessage object after the while loop terminates for the last time.
In php this would be a case of
while ( $returned = myObject->myMethod()->finished )
{
}
if( $returned -> finished == FALSE)
{
...
}
However trying to assign like this gives me a boolean expected error in java (there might be php errors in the above, it's late :D )
while
in Java requires a boolean-typed expression (someVar = boolExpr
is itself a boolean-typed expression). If the variable assigned was abool
then it would be identical. Please show the current Java code as it is likely that something of non-bool is being assigned. In any case, with few exceptions, I would recommend not using this idiom... – Bryce