aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes  & and | Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark " & and |" Watch " & and |" New topic
Author

& and |

srinivas sridaragaddi
Ranch Hand

Joined: Jul 24, 2007
Posts: 225


output 1 7

please explain. And is this type question on 1.5 also


SCJP 5.0<br /> <br />"Skills are started with learning and mastered with improvement. Nothing is hereditary except death" BUDDHA...
kurt hanni
Ranch Hand

Joined: Aug 11, 2007
Posts: 140

this are bitwise operations, the bits for 3 = 0011 and 5 = 0101


the "&" (AND) operator returns 1 if both bits are 1
x = 3 & 5;
bits
x = 0011 &
0101
------
0001
x = 1


the "|" (OR) operator returns 1 if both or either bits are 1
y = 3 | 5;
bits
y = 0011 |
0101
------
0111
y = 7


SCJA, SCJP, SCJD, SCMAD, SCWCD, SCBCD, SCDJWS, SCEA, SOA, Spring Certified, OCP MySQL 5 Developer, PMP
kurt hanni
Ranch Hand

Joined: Aug 11, 2007
Posts: 140

and no they arent in the scjp 5 exam
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: & and |
 
Similar Threads
problem...help me ..pls.
Reference Casting
Static initializer order
value of x?
Bowled over by a simple code