This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I only know that if I don't want to "try and catch" a Checked Exception,I can "throws" it away,and if I want to show some mistake message,I can "throw" a Runtime Excepiton/Checked Exception object in a method. If I "throw" a Checked Exception object in a method ,I have to "throws" it in the method declearation,or it will compile error. My problem is that,"if we throw a Runtime Excepitonobject,why don't we need to throws it?". What time shoud we "throws" a Runtime Excepiton ?
Usually we don't throw any runtime exception(s) at all. As an application developer, we're more concerned with checked exceptions (since we're more likely able to recover from such exceptions). Runtime exceptions, on the other hand, when they occurred, usually can't be recovered, hence, even if we were to catch it, there's really nothing we can do to recover from it. For e.g., if the JVM is out of memory, even if you catched that exception, there's really nothing you can do to resolve that issue. Hope this helps.
Thank you ,but I still hadn't get the point. My text book wrote that ,"Excepiton" is what we can control and "Error" is what we can't control . Maybe what you talked about is "Error",not"Runtime Exception". Please tell me.