logical operation in java
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
I have been trying to implement the following condition in a more sofisticated manner:
want to code it like:
Is this not possible at all? | |||
Not possible if
P.S: Why you want to | |||
Not in full generality; the arguments in the ternary (formally the ternary requires expressions) have to evaluate to the same type. If doSomething() is a | |||
It is dependent on return type.If you define like this | |||
No you can't. In JLS §14.8
Oops, no | |||
The ternary is used for inline if conditions. They need a return value, because u could write something like that:
with void this would not be possible | |||
lang-java
.
stackoverflow.comm
No comments:
Post a Comment