Why handicapped SWITCH?

Why, with all of the cool stuff Java can do, does the Switch statement only accept integer values? It would be nice to be able to use Switch and If/Else interchangeably.
Josh

Yes, but like I said - how would you evaluate the
strings equality? Using the equals method of the
string class? How about the equalsIgnoreCase method?
It's not very intuitive ...And in reality of course the switch cases are acting like the '==' operator, which wouldn't normally work for strings anyway. But I agree, if it could smartly determine whether to use == or .equals depending on the switch argument, it would be nice (and I would think those two would do - equalsIgnoreCase doesn't really fit)

Similar Messages

  • Why, after switching DVD player, can my macbook still not burn CDs?

    Hey Apple,
    I wanted to ask you one thing:
    My macbook Pro is a little over two years old, and I am loving it. Although, it has been a couple of months that my DVD player is not working smoothly. I went to the Genius Bar, since I couldn't even burn CDs - which is my biggest concern-, and I left it there so they could switch the DVD player completely. Now, as I try to burn CDs again, it says Medium write error again. I want to know why. I have read previous discussions, but I just bought these blank CDs, and they used to work perfectly before.
    Have any idea why this is happening?

    Hello, tIsP-el11. 
    Thank you for visiting Apple Support Communities.
    Here are the best steps to go through when experiencing issues with your SuperDrive.
    Apple Computers: Troubleshooting the slot-loading SuperDrive
    http://support.apple.com/kb/HT2801
    Cheers,
    Jason H.

  • Why does switching VoiceOver on jump to the top of a web page? Is there a way to stop that and just stay where you were?

    Please someone tell me why this happens and what I can do to prevent it because it is so annoying to scroll down every time. Thanks!

    You can try it with CTRL+Home to see if that improves matters.
    List of KB shortcuts here: http://www.mozilla.org/docs/end-user/moz_shortcuts.html#help

  • Why not switch from Firefox 3 to Tiger (10.4.11) Safari?

    I prefer to use one browser. When I had Panther I used Safari until problems occurred with some sites, so I switched to Firefox 2. I upgraded to OS 10.4.11, mainly to use FF3, which I'm now using.
    The problem is, I like the AutoFill feature of Safari. FF3 doesn't have it. But, it seems Safari is not updated as frequently as FF3 re: security issues. So, I guess the choice is between better security vs. AutoFill. Right?
    As to AutoFill, a member of my Mac user group said, "Who is to say there isn't some exploit found someday, and they can grab the saved contents of what goes in your Autofill?" He's a knowledgeable Mac guy & I don't take his input lightly. He uses FF, btw.
    I prefer Safari & am asking you if there is any reason not to switch to it from FF3, which seems the browser of choice for a lot of people. I'll keep FF3 in my apps folder. BTW, I've used Safari in earlier versions for years & never had a security issue, AT LEAST THAT I'M AWARE OF.
    So, I guess it's like I said: Do I want security, or do I want AutoFill? Maybe this is a false issue & I'd like some expert advice on this.

    Hi David,
    Do I want security, or do I want AutoFill?
    Ideally, both Firefox does have a level of autofilling, for example it will autofill usernames and passwords, but I'm guessing you are referring to the filling in of your name, address etc when filling out some forms?
    As to AutoFill, a member of my Mac user group said, "Who is to say there isn't some exploit found someday, and they can grab the saved contents of what goes in your Autofill?"
    True, I don't disagree with that, but the same applies to Firefox's autofill feature as well. I know both Safari and Firefox encrypt their autofill databases but other than that I don't know if one is 'more secure' than the other. The only way to be 100% safe is to not use autofill in either browser - at the end of the day it boils down to convenience versus security.
    But, it seems Safari is not updated as frequently as FF3
    I think that's more a perception thing than anything else. True, Safari updates do come around a bit less frequently than Firefox, but Apple do release periodic Security Updates and these do correct security issues in WebKit which is the engine that drives Safari.
    Both are fine browsers. If you prefer Safari, I'd say go for it. I don't think either is more insecure than the other. If you twisted my arm, I'd say Firefox might be at a tiny bit greater risk simply because of it's popularity compared to Safari (and therefore a juicier target) - but that's just my opinion!
    Hope some of that helps.

  • Why does "Switch to the Cloud" web page take so long to load???

    This web page takes about 5 minutes to load, and then it asks you to login again, and then tells you there is no such login?? (im already loged in to the main adobe site)

    By "Switch to the cloud" page you mean https://creativecloud-specialoffer.adobe.com/special-offer/?loc=en_US? The locale parameter at the end en_US may be differerent for you.
    There is no single sign-on from https://www.adobe.com to the "Switch to the cloud" page. Your Adobe ID should be recognized and you may be prompted to "Enter your date of birth".
    Please email me with your Adobe ID email at [email protected] and I will investigate.

  • Why I switched from Iphone to Android...

    Why can't I download Flash Player for my new Samsung Galaxy S3?

    List of certified devices: http://www.adobe.com/devnet-apps/flashruntimes/certified-devices.html
    Archived Flash Player versions: http://helpx.adobe.com/flash-player/kb/archived-flash-player-versions.html#flash_player_ar chives
    [topic moved to Flash Player forum]

  • Why is switching over multiple tabs in Firefox so slow? how solve this problem please

    My problem is just the slow switching over multiple tabs in Firefox. Each time I go to another tab it takes a while (sluggish), or you can say the ‘click’ on the tab takes time to happen. The rest Firefox is working perfect in speed.
    Don’t know how to solve it, followed all the steps on the MakeUseOf Firefox Speed Up Guide, still having same problem.
    please help me

    Hi tahas,
    Have you looked at our [https://support.mozilla.org/en-US/kb/firefox-slow-or-takes-too-long-start performance troubleshooting section]? There is a lot of good information in there that should help.
    Hopefully this helps!

  • Why access switch has flapping lead another distribution layer switch has root guard blocking and unblocking log

    is it misconfiguration in Access Point's access switch or hacker attack from this switch?
    many MATM-4-MACFLAP_NOTIF Host 0015.5dc1XXX VLAN 1 is flapping between port 1 and port 2
    many MATM-4-MACFLAP_NOTIF Host 0015.5dc2XXX VLAN 1 is flapping between port 1 and port 2
    many MATM-4-MACFLAP_NOTIF Host 0015.5dc3XXX VLAN 50 is flapping between port 1 and port 2
    many MATM-4-MACFLAP_NOTIF Host 0015.5dc4XXX VLAN 50 is flapping between port 1 and port 2
    last time we do not have these switch also meet the same issue about distribution layer switch have many ports down
    last time someone mention a switch lost config, but today, i remember that the switch has reloaded and can be login again with radius, 
    today i do not connect any notebook with this switch and just have configured radius setting for window NPS radius server and then reload, then
    i have dinner and come back and after a while, last time's issue happen again. 
    it seems port channel easy to have problem when abnormal traffic coming from access switch  result in down port in distribution layer switch
    i wonder whether someone can hack through the switchport access mode port and send some broadcast message

    From that output and your description it looks like you have an STP issue as a result of misconfiguration somewhere.
    Are your access points connected to switches with ports in access mode or trunk mode?

  • Why does 'Switch to Fluid Grid View' toggle button not working?

    I don't see the grids in the Fluid Grid Layout and nothing happens this button's On/Off stages.
    Also getting an error 'Could not find Dreamweaver Fluid Grid style sheet.' when inserting any element as Fluid Element.
    Please help, thanks.

    @Binson: I'm following your post on another thread too.
    Anyway, FG elements can only be inserted into FG Layout documents.
    On FG Layout page if you're getting that error, you probably have some file integrity issues and DW is unable to locate your FG stylesheet.

  • Mail or gmail? why should i switch?

    so i'm a recent switcher. i'm happy happy happy with the things about macos that enable much greater productivity and pleasure when interacting with my little macbook.
    so the reason to switch from PC to MAC is very clear. i can easily talk to others and explain why the switch makes sense.
    one thing is that i've been a long time gmail user and before that yahoo web mail. i've seen the benefit (especially on the PC) of not having mail stored locally (size, virus etc.)
    now i'm thinking about using .mac and macos mail app to handle my mail instead of gmail. ive tried it for a day or two and i haven't had any AHA moments that made the reason for a switch like that clear.
    all this to say, how many of you use mail or a webmail client like gmail? what are the reasons why one would use .mac and mail versus gmail?
    any guidance is greatly appreciated.
    sean
    ++sig++
    email-------> [email protected]
    tumblrblog--->http://sean808080.tumblr.com/
    myspace---->http://www.myspace.com/sean808080

    Hi Sean,
    Take it from someone that has lived and worked around the world most of my life I more than understand your questions on .Mac, mail, web based mail like Yahoo, Gmail, Gmx and the Apple 'mail application' with our Mac's. I know the advantages and disadvantages of them all, been there done that.
    As far as becoming a part of .Mac and paying the annual fees? Remember with .Mac you're getting more than just an e-mail address. You get web publishing, some storage space, iPhoto space and more. Whether you decide to use .Mac depends on how much of your world is tied to Apple. If many of your friends use a Mac then it allows more access to them and sharing files, iChat and simply makes connecting your different worlds together. You can sync your mail, address books, iCal, iTunes .... and the list goes on. Again it depends on how much of your life is connect to Apple products.
    The advantage to using the Mac's 'mail application' is that you can also use your Gmail account there too. Gmail allows you to connect with a POP connection where Yahoo does not. You can also use the new Gmail desktop. It operates like 'spotlight' that comes with your Mac. It also always Gmail voice and IM chats and more. Check this link:
    <http://www.macworld.com/2007/04/firstlooks/googledesktop/index.php>
    If you're new to Mac's it all might take some time figuring out things, but your Mac also makes putting things together way easier than with a PC.
    Take it from someone that is in London one day, Paris the next and then Sydney at the end of the week. When your world is connected in sync life is so much easier. Even if you don't have your Mac with you .Mac allows you to have access and control from anywhere and keep it all in sync. In the end it's all about your needs.

  • Why did you ruin the perfect phone with an update to Lollipop? It wasn't broken---why did you feel the need to "fix" it?

    The S5 was PERFECT until Lollipop installed. Now? I have no end of glitches and it drains my battery much faster. What is the obsession that companies have with "improving" something when, in fact, they rarely do? When my last phone went to Kit Kat it was, essentially, a paperweight which is why I switched to the S5. I HATE!!!!!!!!!!!!!!!!! iPhones but at least you only have to deal with the update nightmare once a year with them. STOP! Or at the very least, make it an option. If people are happy with the OS they have...leave us alone!

    I agree. Verizon and Samsung both blamed each other and then they blamed Google.  In my eyes, shame on all of them for releasing and rolling out an update that clearly wasn't ready, nor was it properly beta-tested by ANY of the companies.  It's completely preposterous in this day and age to release a product of such subpar standard! I've worked for engineering companies where anything happening like this (even HALF as bad) would result in heads rolling (immediate job loss). Everyone I know that updated to lollipop is suffering

  • Simple JS works in Acrobat 7, but not 8 - why?

    I have a simple form with 2 fields: "myname" and "phone". "myname" is a drop down list populated with 3 names. I want to be able to populate the "phone" field with a phone number corresponding to the "myname" field automatically.
    I have the following JS attached to the calculate event of the myname field. This works perfect in Acrobat 7.0.9, but does not work at all in Acrobat 8.0 professional or Adobe Reader 8. Does anyone know why?
    switch (myname.rawValue){
    case "Beth Voigt" :
    phone.rawValue = "431-3833";
    break;
    case "Bobbie Hartfiel" :
    phone.rawValue = "431-2019";
    break;
    case "Dave Brown" :
    phone.rawValue = "431-2448";
    break;
    default : phone.rawValue = "";
    event.newText = myname.rawValue;

    I was just asking where those scripts are located.
    You can configure Chrome to use Reader instead of its built-in viewer: http://blogs.adobe.com/vikrant/2010/12/use-adobe-plugins-to-view-pdfs-inside-google-chrome /

  • Switching between Design and JSP tabs add code?

    I am new to SJSC and I am taking the time to go through all of the little odds & ends of the IDE.
    I was looking at:
    http://blogs.sun.com/roller/page/tor?entry=computing_html_on_the_fly
    And I decided to try this.
    When I add the following in the JSP tab:
    <h:outputText binding="#{Page1.tableHtml}" id="outputText1"/>Save.
    Then click on the Design tab, then go back to the JSP tab, I now have:
    <h:outputText binding="#{Page1.tableHtml}" id="outputText1"/>
    <h:outputText binding="#{Page1.outputText1}" id="outputText1"/>It's late here, but this doesn't make any sense, why would switching between Design and JSP tabs add code?
    Thanks,
    --Todd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Girish: I followed these steps:
    1.) Downloaded:
    Sun Java Studio Creator 2, Multilanguage creator-2-windows-ml.exe 254.23 MB
    2.) When I started the install, I received the message:
    Welcome to Sun Java(TM) Studio Creator 2! You are installing: Sun Java Studio Creator 2 development environment Sun Java System Application Server Platform Edition 8.1 2005Q1 Update Release 2 Bundled database
    3.) Installed version:
    Product Version: Java Studio Creator 2 (Build 060120)
    IDE Versioning: IDE/1 spec=5.9.1.1 impl=060120
    Also, Under, the Palette window: Standard component list, there is a component labeled Output Text.
    When placed on a jsp, the following code is produced:
    <h:outputText binding="#{Page1.outputText1}" id="outputText1" style="position: absolute; left: 24px; top: 48px"/>Thanks,
    --Todd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Usage of Switch Case

    Hi,
    I would like to get some help with regard to usage of Break inside Switch . And moreover can we have a name for switch statements.
    ex : <switch name='xyz'>
    Thanks,
    Jeyanth

    yawmark wrote:
    TUIJAVADEV wrote:
    I have test case to test the case 1 and 2 but I am not able to test default case. Can anyone please let me know how can I right a junit test case for default case.If your enum values are ONE and TWO, and you have cases for both, then there is no "default case". There is nothing to test.
    ~If I'm reading the OP correctly, they're 1 and 2, not ONE and TWO. That is, not values of a Java enum.
    If this is the case, then the easiest way to test the default case is to break the swtich out into a separate, package-accessible method that takes and arg and passes that onto the switch. (There may be variations on this, depending on how your code is structured.)
    However, in a similar vein to what the others are saying, if you already know that you'll only ever have 1 and 2 by the time you get to the switch (maybe because the value comes from an argument to the enclosing method, and you've already unit tested that it appropriately throws an IllegalArgumentException when other values are passed, then there's no need to test the default.
    Finally, though if it is ints 1 and 2, rather than a true enum, why not switch to an enum?

  • "Switching"?

    Seems like a lot of you guys are switching to a Mac Pro from your PC, which as someone who's always used Macs is very cool to see. I think Apple has a winner in the Mac Pro.
    Out of curiosity, if you do consider yourself a switcher, are you planning on using Mac OS X as your primary OS? Are you going to use Windows as a secondary OS or primarily Windows with some Mac OS X use on the side?
    Mac Pro 2.66 soon   Mac OS X (10.4.7)  

    I'm a 'switcher' but it wasn't from Windows. In fact I never owned a copy of Windows and was a diehard OS/2 advocate for many years. If you wrote to "The OS/2 Guy" at IBM, IBM forwarded the messages on to me and at one time I ran the largest OS/2 subscription web site on the 'Net (Warp City).
    I was despised by the Microsoft crowd who spent years invading the OS/2 newsgroups and attacking me and the OS/2 operating system. At times I found my personal life disrupted by fanatical stalkers, physical threats, and non-stop harassment. They went after my associates, my employees, anyone who provided articles at my web site or even came to my support publicly.
    But that's not why I switched. I did so because IBM finally dropped support for OS/2 on January 1, 2006, and that meant there would be no new drivers, updates, upgrades, enhancements, applications, etc. Imagine if Apple announced tomorrow that they would no longer sell OSX! I spent thousands of dollars on custom made machines with hardware that was proven to support OS/2. Before selling off the ThinkPad division to Lenovo, IBM returned to providing support for OS/2 on their newest ThinkPads. This extended my OS/2 life but it was evident a move had to be made. I bought three of them fully loaded with as much hardware as I could get but I wasn't happy because I kept falling farther behind the rest of the computing world.
    I had two alternatives: Linux or OSX
    OSX is so akin to OS/2 that the transition was easy to handle and learn. And Mac users who ventured into the OS/2 community were usually cordial and informative. I struck up a conversation with a former OS/2 (college) buddy I had lost contact with (career paths changed). "Once I bought a Mac I never looked back at OS/2 and I fell in love with computing again," he said.
    I bought the Intel iMac within the first 17 minutes of its announcement and once I used it my friend was right. I fell in love all over again with an operating system and a company that offered me advanced hardware and beautiful machines. Soon I replaced my office computers with iMacs and within moments of the MacBook announcement I had my order in.
    Now I await the arrival of a Mac Pro. I spent big bucks. The 30" Cinema HD monitor arrived today and the MP is scheduled for delivery on Sept. 26th because I loaded it up with as much hardware I could.
    I know I made the best possible choice and thank the heavens above for saving me from having to deal with Microsoft.
    That's why I switched and I'd do it again in a heartbeat.
    Tim...
    20" iMac 2GRam/500G-HD, 13" BlackBook 2GRam/120G-HD, Black Video iPod 60Gig   Mac OS X (10.4.7)   HPColorLaserJet 2500 Printer, LaCie 600Gig External & LaCie DVDRW/CDRW Drives

Maybe you are looking for

  • How to configure IPM alert in IPM 2.6 for Windows?

    I am trying to figure out if there is a way to configure IPM to send out an alert when the performace reaches or falls beyond certain threshold?  In this case, I am trying to create a new HTTP operation.  On the General tab > Latency Threshold Settin

  • Can't include C-code in objective-c project

    I am having problems including a little C source code file in an existing objective-c project. The problem is that xcode spits out lots of warnings and error messages when it tries to compile the whole project or just the C file, in particular, lots

  • Air loses left USB connection periodically (MB Air 11" i7 (1.8))

    I want to ask if this could be a software issue or if I should go into the store and have it repaired. Around 15 minutes in my left USB lose the connection to an external USB HDD - I have tried 2 different hard drives and it also happens with the Air

  • Is something wrong with the search?

    Hi, I have tried several days. It seemed that the search did not work? Could the forum coordinator have a look at this? Thanks

  • Mountain Lion killed my Office 2008 suite!

    Mountain Lion disabled my Office 2008 applications. I've tried installing the Office 2011 suite (don't have a key number for the 2008 version, so downloaded a 30-day trial version of 2011, it's also having stumbling/locking up). Should I simply unins