What does unreachable statement mean?

I'm trying to write an Exception to prevent a denominator in my program from being 0.
public String toString()
        return num + "/" + denom;   
        if(denom == 0)
            IllegalArgumentException exception = new IllegalArgumentException("fractions must not have denominators of zero");
            throw exception;
    }But all I get is unreachable statement.

Knotty_Boy wrote:
Ah that makes sense then, I'm a bit confused where I'm meant to put the code then, I'm carrying out 4 different operations on the fractions (add, subtract, multiply, divide) I need to ensure that the denom isn't a 0, so would I be best creating a method that tests for a zero Yes. Follow the DRY principle: Don't Repeat Yourself. If you find yourself writing the same code in several places, put that code into a method.
and then calling that at the end of each of the 4 operations and then throwing an exception if the answer is incorrect?No. Why would you do it at the end? You have to do it at the beginning. When you return, the method ends, and nothing after the return statement is executed. That's why you get that exception, as people have been explaining.
When you go to the cash machine, and ask for $50,000, does it first spit out the money, and then tell you "Insufficient funds"? If so, please tell me where you bank!

Similar Messages

  • What does this statement mean: "There is a problem with your authentication, possibly due to inactivity. For your safety, you have been logged out and must sign in again to continue?"

    I am able to make it to the site for about 2 seconds and then I am quickly logged off and the statement, "There is a problem with your authentication, possibly due to inactivity. For your safety, you have been logged out and must sign in again to continue."
    I don't have a clue as to the problem but since this is impacting my participation in these classes and ultimately could have a negative impact on my grade, I am more than a little concerned!

    Have you allowed this site to set cookies?

  • What does this statement mean:

    I am having trouble downloading and installing iTunes to my laptop.  Once iTunes is installed and I plug my Iphone into my laptop I get the following message:   "The iTunes Library.itl file cannot be found or created.  The default location for this file is in the "iTunes" folder in the "Music" folder." 
    I have uninstalled and reinstalled several times and I still can get it to work.  The iTunes folder is there but when I try and open it I get the message above.  Can someone help or have any of you had this message come up when you installed iTunes? 
    Thanks for the help of any kind.
    Hines25

    It could be that there is a corrupt iTunes Library.itl file that iTunes is not managing to either open or remove. If this is to be a fresh install of iTunes you could delete the library file if it is there.
    Repair Permissions
    Right-click on the iTunes folder in "User's Music" and click Properties, then go to the Security tab and click Advanced. If necessary grant your account and system full control to this folder, subfolders and files, then tick the option to replace permissions on child objects which will repair permissions throughout the library. This is the XP dialog but Windows 7 shouldn't be too different.
    If you had a previously working library on this laptop then try this...
    Empty/corrupt library after upgrade/crash
    Hopefully it's not been too long since you last upgraded iTunes, in fact if you get an empty/incomplete library immediately after upgrading then with the following steps you shouldn't lose a thing or need to do any further housekeeping. In the Previous iTunes Libraries folder should be a number of dated iTunes Library files. Take the most recent of these and copy it into the iTunes folder. Rename iTunes Library.itl as iTunes Library (Corrupt).itl and then rename the restored file as iTunes Library.itl. Start iTunes. Should all be good, bar any recent additions to or deletions from your library.
    See iTunes Folder Watch for a tool to catch up with any changes since the backup file was created.
    When you get it all working make a backup!
    tt2
    tt2

  • What does the statement: "Java has a standard!" mean?

    I'am writing a academic work. For that I need to compare Java and PHP. I found the statement "Java has a standard!" as advantage on a webpage, but what does it exactly mean???
    Edited by: drumn on Aug 6, 2008 5:45 AM

    drumn wrote:
    I'am writing a academic work. For that I need to compare Java and PHP. I found the statement "Java has a standard!" as advantage on a webpage, but what does it exactly mean???Ask the author.
    I'm not being facetious or trying to brush off your question. If you want to know what someone meant when they said something, ask them. It's the most direct line and gives the highest probability of getting a useful, accurate answer to your question.
    ~

  • HT201210 What does error 1015 mean when restoring my Iphone 3G?

    What does error 1015 mean when restoring my Iphone 3G?

    As easily found by googling:
    Errors related to downgrading iOS
    The required resource cannot be found: This alert message occurs when your device has a newer version of iOS than what is available in iTunes. When troubleshooting a device that presents this alert message, go to Settings > General > About and check the version of iOS on the device. If it is newer than the latest released iOS version, the device may have a prerelease developer version of iOS installed.   Installing an older version of iOS over a newer version is not supported.
    Error 1015: This error is typically caused by attempts to downgrade the iPhone, iPad, or iPod touch's software. This can occur when you attempt to restore using an older .ipsw file. Downgrading to a previous version is not supported. To resolve this issue, attempt to restore with the latest iPhone, iPad, or iPod touch software available from Apple. This error can also occur when an unauthorized modification of the iOS has occurred and you are now trying to restore to an authorized, default state.
    In summary: your phone is likely jailbroken. If so, there is no more support available on these forums.

  • What does "Wi-Fi" Mean?

    My Subject line _is_ my question:  "What does 'Wi-Fi' Mean?"
    I have my own guess:  "Wireless Fidelity".  Synonyms of Fidelity are Truth & Reliability.  [No, I will not discuss Politics!  :-) ]

    The name[edit]
    The term Wi-Fi, commercially used at least as early as August 2000,[17] was coined by a brand-consulting firm called Interbrand Corporation. The Wi-Fi Alliance had hired Interbrand to determine a name that was "a little catchier than 'IEEE 802.11b Direct Sequence'".[18][19][20] Phil Belanger, a founding member of the Wi-Fi Alliance who presided over the selection of the name "Wi-Fi," also stated that Interbrand invented Wi-Fi as a play on words with Hi-Fi (high fidelity), and also created the Wi-Fi logo.
    The Wi-Fi Alliance initially used the advertising slogan, "The Standard for Wireless Fidelity",[18] for Wi-Fi but later removed the phrase from their marketing. Despite this, some documents from the Alliance dated 2003 and 2004 still contain the term Wireless Fidelity.[21][22] There was no official statement related to the dropping of the term.
    The yin-yang Wi-Fi logo indicates the certification of a product for interoperability.[21]
    Non-Wi-Fi technologies intended for fixed points such as Motorola Canopy are usually described as fixed wireless. Alternative wireless technologies include mobile phone standards such as 2G, 3G or 4G.
    http://en.wikipedia.org/wiki/Wi-Fi

  • I have a wireless network at home. I run my iphone and ipad on it with no problems. Just purchased a MacBook Pro, and now my wi-fi keeps disconnecting and i get an error message saying another device is using the same IP address. What does all this mean?

    I have a wireless network at home. I run my iphone and ipad on it with no problems. Just purchased a MacBook Pro, and now my wi-fi keeps disconnecting and i get an error message saying another device is using the same IP address. What does all this mean?

    Hello AKCamus
    To give you some ideas of what to do next, I have provided a few articles that will give some troubleshooting Wi-Fi connections and recommended Wi-Fi settings.
    iOS and OS X: Recommended settings for Wi-Fi routers and access points
    http://support.apple.com/kb/HT4199
    iOS: Troubleshooting Wi-Fi networks and connections
    http://support.apple.com/kb/ts1398
    Troubleshooting Wi-Fi issues in OS X Lion and Mac OS X v10.6
    http://support.apple.com/kb/HT4628
    Thanks for using Apple Support Communities.
    Regards,
    -Norm G.

  • What does this message mean:  this apple ID has not yet been used in the iTunes store"? I cant connect using my iphone. But it works in iTunes on my laptop.

    what does this message mean:  this apple ID has not yet been used in the iTunes store"? I cant connect using my iphone. But it works in iTunes on my laptop.

    FAQ apple id http://support.apple.com/kb/HT5622?viewlocale=en_US
    http://support.apple.com/kb/HT1311

  • What does this message mean?  "ITunes has fetected an iPad in recovery mode.  You must restore this iPad before it can be used with ITunes".

    What does this message mean?  "itunes has detected an iPad in recovery mode.  You must restore this iPad before it can be used with ITnes."  How do I restore when every time I connect to my computer I get this message?

    Perhaps the information in this Apple support article will help:
    http://support.apple.com/kb/TS3694#error3004
    Regards.

  • What does this message mean Charging is not supported with this device?

    What does this message mean Charging is not supported with this device?

    You've gotten 2 good answers already, but there's a key assumption in both that you got the message when connecting the iPhone to some other device. If this is the case you can get an adapter in the Apple online store that will allow charging from older devices.
    If, however, this message appears when you are not connected to anything the problem is dirt or moisture in the dock connector at the bottom of the phone. Clean it with a dry toothbrush or air blast.

  • What does this message mean? : "The file name "DSC_0088.jpg" is offline or missing." ?

    What does this message mean? : "The file name "DSC_0088.jpg" is offline or missing."   I am in the process of importing photos from iPhoto (don't really know what I'm doing....) and when I look at one of the imported photos that message pops up.  I know what "DSC_0088.jpg" is.  I don't know what it means that the file is "missing".

    CASpyr,
    Thank you so much for your reply.  I have a couple of bigger issues that I am dealing with: too many photos on my laptop: 40,000! (Of course I have to throw away many of them, but that is time consuming). I have a MacBook Pro and have primarily used IPhoto. I have recently purchased 2 external drives and have transferred my photos to those, but I need a basic education about how photos are stored, copied, etc.  I have recently been told that iPhoto only shows and deals with jpegs, not RAW.  About 1/3 of my photos are RAW, so I purchased Lightroom, so I could do more with those RAW photos.  I have been told by my local Mac store that I need to delete most of my photos from iPhoto, because it's causing problems.  I am reluctant to do so until I am sure that all of the keywords, descriptions and editing I have done to these photos is not lost when deleted from iPhoto. I just watched a tutorial about importing to Lightroom and got out of it that I needed to copy photos from iPhoto to a file on my desktop and then copy to Lightroom.  I did that, it seemed to work.  Then (because of my storage/memory issues) I deleted the photos (just a few as an experiment) from that desktop file.  I'm guessing that is why Lightroom doesn't recognize the the photos.  It seems that (learned from another tutorial) that one uses "Add" , Lightroom is only connecting to the source of the photo, not  actually copying it to the program.  Sounds like I need to use the "Move" feature instead.  My ultimate goal is to store the photos on the 2 external drives and eliminate most of them from my lapop.  So my basic questions have to do with what data (metadata??) is copied from iPhoto to an external drive (RAW???) and what isn't copied. Basic understanding issues,obviously….  I hope this isn't too much to ask.  If you can recommend a book or resource that can explain those basic issues to me I'd appreciate it.  I just got back from a trip and I can't download my new photos until I manage the rest!
    Thanks,
    Nancy

  • What does this message mean - The operation can't be completed because the item "12b" is in use.

    The operation can’t be completed because the item “12b” is in use.  What does this message mean.  It appeared as I was attempting to clear my time machine backup?

    Reboot your machine make sure Aperture doesn't start (as Lion is liable to do) and try it.

  • What does this message mean baring in mind we don't know who 'Lareib' is?: ''Lareibs phone' is now using (my number) for iMessage'

    What does this message mean baring in mind we don't know who 'Lareib' is?: ''Lareibs phone' is now using (my number) for iMessage'

    How would we users in this forum also know who Lareib is?
    It means what is stated, that person is now using your number for imessage.

  • What does this message mean? "Warning: SUID file "System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/MacOS/ARDAg ent" has been modified and will not be repaired"

    What does this message mean? "Warning: SUID file "System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/MacOS/ARDAg ent" has been modified and will not be repaired"  I get this when I try to repair permissions in disk utility.

    It's an innocuous error you can ignore. It was introduced with previous updates for ARD and/or Java before Lion. These are messages, not errors. They will cause no harm, and they will be repeated each time you repair permissions.

  • What does this message mean: "power pc applications are no longer supported"?

    What does this message mean: you can not start because power pc applications are no longer supported?

    Here is a post that I assembled for another who needed to continue to run his PowerPC applications in Lion/Mt. Lion:
    Unfortunately you got caught up in the minor miracle of Rosetta.  Originally licensed by Apple when it migrated from the PowerPC CPU platform that it had used from the mid-1990's until the Intel CPU platform in 2006, Rosetta allowed Mac users to continue to use their library of PPC software transparently in emulation.
    However, Apple's license to continue to use this technology expired with new releases of OS X commencing with Lion (and now Mountain Lion).  While educational efforts have been made over the last 6 years, the fact is that Rosetta was SO successful that many users were caught unaware UNTIL they upgraded to Lion or Mountain Lion.
    Workarounds:
    1. If your Mac will support it, restore OS X Snow Leopard;
    2.  If your Mac will support it, partition your hard drive or add an external hard drive and install Snow Leopard into it and use the "dual-boot" method to choose between your PowerPC software or Lion/Mt. Lion;
    3.  Upgrade your software to Intel compatible versions, or find alternative software that will open your data files;
    3.  Install Snow Leopard (with Rosetta) into Parallels:
                                  [click on image to enlarge]
    Full Snow Leopard installation instructions here:
    http://forums.macrumors.com/showthread.php?t=1365439
    NOTE: STEP ONE of the instructions must currently be completed on a Snow Leopard or Lion Mac and the resulting modified Snow Leopard.cdr install file can then be moved over to your Mountain Lion Mac for completion of the remaining steps.
    NOTE 2:  Computer games with complex, 3D or fast motion graphics make not work well or at all in virtualization.

Maybe you are looking for