Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
Forums
Register
Login
Java
»
Beginning Java
Return statement
Roberto Favaro
,
Greenhorn
Apr 20, 2007 09:03:00
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
Is this piece of code
public synchronized boolean allowed(City c) { if(tabu.contains(c)) return false; else return true; }
the same as this
public synchronized boolean allowed(City c) { return((tabu.contains(c)) ? false : true); }
or have I mixed up the true and false.
Thanks in advance....
Henry Wong
,
author
staff
Apr 20, 2007 09:15:00
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
Yup... both methods are equivalent. But how about this instead?
public synchronized boolean allowed(City c) { return(!tabu.contains(c)); }
Henry
Post by:
autobot
He was giving me directions and I was powerless to resist. I cannot resist this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
reply
This thread has been viewed 542 times.
Similar Threads
IllegalMonitorStateException (not what you think)
Feed the Pets
Shocking code
simple synchronized question
boolean return question
More...
All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 10:00:07
.