Difference between getmessage and getlocalizedmessage in exceptions Java?
- Start DownloadDownload Free Software: Converter Start Here!www.Donwload.pconverter.com
- Nexus 4The new phone from Google. Buy unlocked, contract free. From $299.www.google.com/nexus
- Online Computer ClassesLearn Computer Skills from Home. Accredited. Only $5 to enroll.www.CIE-WC.edu
Answer:
Java Exceptions inherit their getMessage and getLocalizedMessage methods from Throwable (see the related link). The difference is that subclasses should override getLocalizedMessage to provide a locale-specific message.
For example, imaging that you're adapting code from an American-English speaking company/group to a British-English group. You may want to create custom Exception classes which override the getLocalizedMessage to correct spelling and grammer to what the users and developers who will be using your code might expect. This can also be used for actual translations of Exception messages.