Forums Register Login

What does ~ do?

+Pie Number of slices to send: Send
It isn't in the book but it is on an enthuware test. I googled and couldn't find the answer.
1
+Pie Number of slices to send: Send
It is called a tilde, to help you google it. It is the bitwise not operator

a = 0b010;
b = ~a;
b == 0b101;
1
+Pie Number of slices to send: Send
It's the unary bitwise complement operator "~". That makes googling a lot easier

It inverts a bit pattern; it can be applied to any of the integral types (not on booleans), making every "0" a "1" and every "1" a "0".

Nice to know: bit-twiddling operators are not on the OCA exam.

Hope it helps!
Kind regards,
Roel
+Pie Number of slices to send: Send
Thanks!
1
+Pie Number of slices to send: Send
+Pie Number of slices to send: Send
Thanks!
I don't get it. A whale wearing overalls? How does that even work? It's like a tiny ad wearing overalls.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 840 times.
Similar Threads
Whizlabs SCJP 5.0 Simulator and Enthuware JQPlus 5.0
few questions
What is persistencecontext and EntityManager ?
Displaying a progress in a popup-window while waiting
Passed OCAJP 7 with 81%, Still can't believe it
More...

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