Forums Register Login

short circuiting in java (was: hi)

+Pie Number of slices to send: Send
Hello everyone, can you please tell about short circuiting in java

[jc edit: changed the title of your post]
+Pie Number of slices to send: Send
If you have come across code which does this- We could discuss it. Basically its used to avoid extra evaluations in Boolean expressions.

And as mentioned earlier- A meaningful subject line would draw the attention of other members and would help you in getting your query answered at the earliest.
+Pie Number of slices to send: Send
I wasn't sure what you meant by "short-circuiting"; you mean the short-circuit operators.
In the case of && and ||, you can sometimes tell the value of the entire expression by evaluating its left half, so false && ... always evaluates to false, and true || ... always evaluates to true. So the JVM only evaluates the left half of the whole expression in those cases.
In the case of true && ... or false || ..., the JVM must evaluate the right half as well.
+Pie Number of slices to send: Send
It's explained in an understandable way at WikiPedia.
When evil is afoot and you don't have any arms you gotta be hip and do the legwork, but always kick some ... tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 761 times.
Similar Threads
Ask her anything
validation in struts2
Short circuit example
Boolean Logic
logical operators for AND and OR
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 16:06:35.