Could someone please help me refresh my memory as to whether this is possible in
Java.... or am I thinking of some other language..
With the humble IF statement is it possible to call a method (with return value) and perform the condition
test on the result of that method additionally being able to access the return value in the IF block...
E.g...
if ((MyObject a = someMethod()) != null) {
a.doSomething();
}
MyObject someMethod() {
if (<condition>)
return new MyObject();
else
return null;
}
Cheers ;-)