Link to home
Start Free TrialLog in
Avatar of krakatoa
krakatoaFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Evaluation of two Booleans.

I need to check with you how to OR two Booleans please.

They need to be Booleans as they’ll be exchanged over a Socket. But they can be booleans locally of course. What’s the suggested best approach?
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Before sending? If so you can rely on unboxing for convenience:

Boolean a,b;
...
oos.writeObject(Boolean.valueOf(a || b));

Open in new window

Avatar of krakatoa

ASKER

No, after sending - i.e., upon receipt. One or the orher must be true, but not both.
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
So the runtime needs min 1.8 ...?
For that particular method, apparently yes. But of course it's not necessary to use that. So - i wouldn't ;)
Fine. The ^ is provenly robust I take it.
Yes

:)