About 10,400,000 results
Open links in new tab
  1. 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 …

  2. 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 …

  3. 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?

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

    Apr 30, 2012 · I almost always find checked exceptions a pain in reality as you almost always end up doing catch/wrap/rethrow to another exception type. When throwing exceptions and …

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

    34 No, one per customer prior to Java 7. You can catch a superclass, like java.lang.Exception, as long as you take the same action in all cases.

  6. What Java exception class to use for HTTP errors?

    Is there an exception in the Java standard library or in a widely used library that would be appropriate to use or to subclass for this purpose? The alternative is to check status return …

  7. java - How do you assert that a certain exception is thrown in JUnit ...

    The problem with any other approach but this is that they invariably end the test once the exception has been thrown. I, on the other hand, often still want to call …

  8. Java 8 Lambda function that throws exception? - Stack Overflow

    258 You can actually extend Consumer (and Function etc.) with a new interface that handles exceptions -- using Java 8's default methods! Consider this interface (extends Consumer):

  9. Order of catching exceptions in Java - Stack Overflow

    Jun 10, 2012 · So, when catching exceptions you want to always catch the most specific first and then the most generic (as RuntimeException or Exception). For instance, imagine you would …

  10. How to add site list to Java Security without using the UI?

    There is an exception list on java security tab like the picture below. I want to add websites to this list using the command line. Is it possible to do that?