About 13,000,000 results
Open links in new tab
  1. How can I throw a general exception in Java? - Stack Overflow

    In C#, you do not have to derive a new class from Exception. You may simply "throw new Exception (message);" for example, and handle it generically in the block that will catch the …

  2. java - What is difference between Errors and Exceptions ... - Stack ...

    Apr 28, 2011 · How can I differentiate between Errors and Exceptions in Java?

  3. How to create a custom exception type in Java? [duplicate]

    A NullPointerException is a classical example. Those exceptions are subclasses of RuntimeException Checked exception must be handled by the calling method, either by …

  4. Can I catch multiple Java exceptions in the same catch clause?

    22 If there is a hierarchy of exceptions you can use the base class to catch all subclasses of exceptions. In the degenerate case you can catch all Java exceptions with:

  5. Difference between java.lang.RuntimeException and …

    Oct 17, 2017 · Someone please explain the difference between java.lang.RuntimeException and java.lang.Exception? How do I decide which one to extend if I create my own exception?

  6. Java Exceptions, What to catch and what not to? - Stack Overflow

    Dec 9, 2009 · 15 Short answer Catch exceptions that you can deal with then and there, re-throw what you can't. Long answer It's called exception-handling code for a reason: whenever you …

  7. When to use exceptions in Java (example) - Stack Overflow

    Apr 30, 2012 · Some people will say that the first is checked exceptions and the second is unchecked. I would disagree with that. I almost always find checked exceptions a pain in …

  8. What is an exception in java? - Stack Overflow

    Mar 6, 2017 · I havea few questions regarding exceptions in java: What is java exception? Is an exception considered an error? When should I throw exceptions? How many kind of exceptions?

  9. Understanding checked vs unchecked exceptions in Java

    Joshua Bloch in "Effective Java" said that Use checked exceptions for recoverable conditions and runtime exceptions for programming errors (Item 58 in 2nd edition) Let's see if I understan...

  10. Java: catching specific Exceptions - Stack Overflow

    Trying to catch exceptions in the order shown in the original question results in a compile error, so the statement "All exceptions will be caught by the first block" is not applicable.