Does bitwise operation on boolean datatypes work like logical operation ?

Does bitwise operation on boolean datatypes work like logical operation ?
For example, in the following code, how is each bitwise operation (say) 'b1 & b2' evaluated ?
1) by converting the values of b1 (true) and b2 (false) to binary and doing '&' on them OR
2) just treating it as a logical operation (i.e. similar to &&) where both have to be equal to be true
Also, does the outcome of the if condition need to result in a 'true' or 'false' for the relevant message to print ? ....... Just fyi, I tried out this program and it goes to condition 2 but I do not understand why.
class SSBool {
public static void main(String[] args) {
boolean b1 = true;
boolean b2 = false;
boolean b3 = true;
if (b1 & b2 | b2 & b3 | b2)
System.out.println ("condition 1");
if (b1 & b2 | b2 & b3 | b2 | b1)
System.out.println ("condition 2");
Thank you,
AG

The Java Tutorial (always my first stop if I need an answer) says :
"When both operands are boolean, the operator & performs the same operation as &&."
That your program goes to condition 2 is obvious because the last test in the if-clause if (b1 & b2 | b2 & b3 | b2 | b1) looks at b1 which is true...

Similar Messages

  • Does the iPad Wi-Fi+3G work like the Wi-Fi model if I have no 3G data plan?

    Hi all!
    Does the iPad Wi-Fi+3G work like the Wi-Fi model if I don't have any 3G data plan subscription?

    Yes it does. Added bonus: You get GPS (which the WiFi model doesn't have but which works without a SIM card).

  • Ryanair 'flights' dialog box does not load; all the rest works, and in Opera it works; can you help? it seems everything else works fine

    Ryanair 'flights' dialog box does not load; I tried in other languages too, it is the same error; it works fine with opera browser in this very same computer I am writing in; please help, if you can; it worked up to two months ago, then I don't know, too long has past from last time I used ryanair, and the rest works all fine, it seems... thanks so much for your time,

    Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).<br />
    See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]<br />
    <br />
    If it does work in Safe-mode then disable all your extensions and then try to find which is causing it by enabling one at a time until the problem reappears.<br />
    You can use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.<br />
    You have to close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit")<br />

  • Why Does My G3 AV Card Not Work Like My 8600AV?

    Hi! I recently upgraded from an 8600AV to a G3AV 333. I have a VCR/DVD combo with cable TV connected. My 8600 gave me great video captures & sound with the Apple Video Player. But the G3's captures have poorer resolution and the sound plays in slow motion, no matter what playback application I use. I recently transfered some of my Family Guy clips from the 8600 to the G3 and they played just fine in QuickTime, Simpltext, and MoviePlayer. But anything I capture thru the G3 plays as described above. Do I need a different AV card? What is the difference between the 820-0971-A card and the 820-0923-A WINGS card. Thanks for any advice!!

    It might be the system software or the AVP application needs to be reinstalled on the G3. It sounds like the sample rate for the audio is not set correctly, so the playback sounds like its in slow motion.
    Try another application for doing the audio/video capture like HackTV or BTV and see if you get the same problem.
    ftp://ftp.apple.com/developer/Quicktime/Tools/ProgrammersTools/HackTV.sit.hqx
    http://www.bensoftware.com/
    G3 Desktop, SonnetEncoreZIF G4 1GHz, 768MB, WingsAV-6MB, DVR-106D, 60GB Maxtor   Mac OS X (10.4.6)   PCI: TempoUltraATA66-120GB Maxtor, 120GB Seagate; TangoUSB/FW; ATIRadeon-17" LCD

  • Does Illustrator on Windows 7 really work like it does on a Mac?  If so, how much is it and where should I buy it.

    I am about to try the Windows 7 version of Illustrator.  Does it really work properly or do I have to have a Mac.

    Cloud Plans https://creative.adobe.com/plans
    -and subscription terms http://www.adobe.com/misc/subscription_terms.html

  • Does anyone have an indicator that works like a compass??

    I'm looking for an indicator that will show compass heading. The gauge indicator has zero at the bottom instead of the top. Thanks in advance.
    [email protected]

    Next,
    pop-up and choose
    properties >>> Text labels
    Check "use text labels for scale markers"
    Un-check "sequential values"
    then enter;
    0 ->
    90 -> E
    180 -> S
    270 -> W
    360 -> N
    and you have a good old fashioned compass. See attched image.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction
    Attachments:
    compass.JPG ‏60 KB

  • Does Group Region Select Edit not work in Logic 8?

    I've been trying to do automation edits across several tracks using group. I have everything except Pan selected. Doesn't seem to catch on. I've had it catch on before but it's hit and miss. Am I missing something or does it just not work right?

    Same here. I have seven channels of drums in comp tracks, and when grouped I am not able to edit the comps. All relevant parameters selected on the group settings, as far as I can tell. Other group functions seem to work fine.
    I am able to select one region of each comp track. If I do more, the whole track greys out. If I try too many times, Logic sometimes just crashes.
    However, the edits I try to make seem to be recorded in the edit history.

  • Does Antares autotune and otherplug ins work with logic and garageband?

    i'm thinking it does, but not sure

    I think it just has to be an 'Audio Units' or AU type plugin. There is a pretty basic pitch correction plugin built into Logic Express. I was pretty impressed with it.
    Larry

  • Does Protools Command 8 control surface work with Logic?

    I thought this would be easier.

    blayzay wrote:
    Sorry its made for P.T. and Pro-Tools alone,
    Fr.BlayZay.
    Not true!
    Command8 is optimised for ProTools, but can be used with other audio apps,
    a short visit to the Digidesign website:
    "Command|8 also includes an integrated, fully editable MIDI interface and features a stand-alone MIDI controller mode, enabling you to use it with your favorite third-party MIDI applications and devices — any that accept MIDI control change messages for level, panning, solo, mute, MIDI Machine Control, and other mappable parameters."
    Best,
    21th

  • Logical operator 'like'

    I have a small query where I have to retrieve vendor details not including the vendors starting with '9'.
    I have written the below query for that.
    select b~lifnr  " Vendor number
         into corresponding fields of table gi_output_vendors
    from  lfa1
    where  lifnr   not like  '9%'.
    But the output I am getting contains vendor numbers '0000950000' where I wanted to eliminate these type of numbers also. i.e, I don't want to consider leading zeroes.
    So, the below code I have written for that.
    The problem is with if condition or delete statement  'like' logical operator is not being allowed.
    loop at gi_output_vendors into wa_output_vendors.
    shift wa_output_vendors-lifnr left deleting leading '0'.
    if wa_output_vendors-lifnr like '9%'   " didn't work delete gi_output_vendors from wa_output_vendors   where
                  lifnr like '9%'. "didn't work
    endif.
    endloop.
    When I use 'like' with 'if' condition or 'delete' statement, I am getting error saying that 'Like operator is not allowed'.
    How could I deal with this situation.
    Thanks in advance.
    Vishnu Priya

    If you can guarantee the 9 will always be in the same place then it would be better to use offset logic or something like 'lifnr NOT LIKE '00009'' - incidentally, I believe the % wildcard only replaces one character so '9%' will be looking for a 2 char string containing a 9 followed by ONE other character.  Using '9' will look for a 9 followed by any number of other characters. Since lifnr is a 10 char field (according to your example) '9%' will always fail. I would suggest using the Data Browser (SE11) selection screens to try out some of the possibilities and see what works.
    Hope that's of some help!
    Andy
    By the way, I wouldn't recommend using '9' becasue this will look for a 9 <b>anywhere</b> in the lifnr field i.e. it could exclude a perfectly valid number just because it ends in a 9!
    Message was edited by: Andrew Wright
    Sorry, ignore me, in SQL you should use % and not * for multiple characters.  However, the same applies if you can guarantee the position of the 9.
    Message was edited by: Andrew Wright

  • How can I downgrade an operating system our bluetooth worked ok on the 4.2.1 system but now we are on the latest system it does not work properly so how can we get the old system back

    how can I downgrade my operating system as my bluetooth work ok with my holde commodore on the 4.2.1 system but now it is upgraded to the latest system it does not operate properley

    thankyou but it looks like we won't be buying another iphone

  • I have an iphone 3g which brought him use me when I brought it worked fine, I updated the system to 4.3.3 and no longer recognizes any network operator, look at the baseband and 5.16.02 and says it is it does not recognize anything I can do? the operator

    I have an iphone 3g which brought him use me when I brought it worked fine, I updated the system to 4.3.3 and no longer recognizes any network operator, look at the baseband and 5.16.02 and says it is it does not recognize anything I can do? the operator to buy my iphone was a 4 but it was stolen, I thought I could use this but aparentementeno, I can do to make it recognize my carrier? thanks

    Looks like you have relocked a hacked phone when you updated.  The only way to fix it would be if you could figure out the original carrier and see if they would unlock it.

  • I updated to yosemite and now if someone is using imessage and sends a text message to my phone it doesn't show up on my phone but does on my computer.  I don't want messages on my computer!  How do I get this to go away and work like it used to?

    I updated to yosemite and now if someone is using imessage and sends a text message to my phone it doesn't show up on my phone but does on my computer.  I don't want messages on my computer!  How do I get this to go away and work like it used to?

    Follow the instructions under the heading "How to unlink a phone number" on this page.

  • My MacBook Pro gets very slow while doing  work like watching movies and using net .. video gets lag very often

    My MacBook Pro gets very slow while doing  work like watching movies and using net .. video gets lag very often and while surffing on net it gets very slow ...

    First, back up all data immediately, as your boot drive might be failing.
    There are a few other possible causes of generalized slow performance that you can rule out easily.
    Reset the System Management Controller.
    If you have many image or video files on the Desktop with preview icons, move them to another folder.
    If applicable, uncheck all boxes in the iCloud preference pane.
    Disconnect all non-essential wired peripherals and remove aftermarket expansion cards, if any.
    Check your keychains in Keychain Access for excessively duplicated items.
    Boot into Recovery mode, launch Disk Utility, and run Repair Disk.
    Otherwise, take the steps below when you notice the problem.
    Step 1
    Launch the Activity Monitor application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Activity Monitor in the icon grid.
    Select the CPU tab of the Activity Monitor window.
    Select All Processes from the menu in the toolbar, if not already selected.
    Click the heading of the % CPU column in the process table to sort the entries by CPU usage. You may have to click it twice to get the highest value at the top. What is it, and what is the process? Also post the values for % User, % System, and % Idle at the bottom of the window.
    Select the System Memory tab. What values are shown in the bottom part of the window for Page outs and Swap used?
    Next, select the Disk Activity tab. Post the approximate values shown for Reads in/sec and Writes out/sec (not Reads in and Writes out.)
    Step 2
    If you have more than one user account, you must be logged in as an administrator to carry out this step.
    Launch the Console application in the same way you launched Activity Monitor. Make sure the title of the Console window is All Messages. If it isn't, select All Messages from the SYSTEM LOG QUERIES menu on the left. If you don't see that menu, select
    View ▹ Show Log List
    from the menu bar.
    Select the 50 or so most recent entries in the log. Copy them to the Clipboard (command-C). Paste into a reply to this message (command-V). You're looking for entries at the end of the log, not at the beginning.
    When posting a log extract, be selective. Don't post more than is requested.
    Please do not indiscriminately dump thousands of lines from the log into this discussion.
    Important: Some personal information, such as your name, may appear in the log. Anonymize before posting. That should be easy to do if your extract is not too long.

  • HT4847 how do i transfer my docs to icloud, does it work like a dropbox

    how do i transfer my docs to icloud, does it work like a dropbox

    You can only transfer iWork documents at present, and only if you have an iOS device with ate least one of the iWork apps on it; in which case you go to the iCloud website, to the iWork page, and drag the documents there. It's not intended for backup, or syncing between Macs, only for allowing your iOS device to edit your documents.
    iCloud does not offer general file storage: for that you will need a third-party solution. This page examines some options:
    http://rfwilmut.net/missing3

Maybe you are looking for

  • Marketplace Download Report

    In the Windows Desktop portal we are able to see where the downloads originate. Is there something similar in the Phone dashboard? I didn't see any other options in the 'Downloads' section.

  • Excise duty + flat rs.10000

    Hi I have one MM cin related query. The client wants for perticulat item the excise duty cond type JMO2 should be 16%+ Rs.10000. By using the AltCaBv routine 363 i am getting 16% exacly, which I have maintained in J1id in excise tax rate  but there i

  • TDMS Data storage problem

    I want to use TDMS file formats to store data from the DAQ. There are dozens of data every 10 ms, at the same time write to TDMS file. I want to ask to do so will be bad for the  hard disk?

  • Problem in connecting to database..

    Hi all, I have deployed a application onto Oracle App Server. In that application i am using sql loader to load file. But it is throwing me: ns main err code: 12560 TNS-12560: TNS:protocol adapter error ns secondary err code: 0 nt main err code: 530

  • Gnome-volume-manager can't automount removable media any more

    Strange,  I don't know why, it worked perfectly, but now it lost functionability. Anyone with any suggestion? Thanks in advance.