About 10,200,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 exception. I'm still …

  2. Java says FileNotFoundException but file exists

    Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - unreported exception java.io.FileNotFoundException; must be caught or declared to be thrown

  3. java - Differences between Exception and Error - Stack Overflow

    Jan 22, 2016 · I'm trying to learn more about basic Java and the different types of Throwables, can someone let me know the differences between Exceptions and Errors?

  4. java - What is a IOException, and how do I fix it? - Stack Overflow

    Sep 6, 2018 · An IO (Input-Output) Exception is predictably caused by something wrong with your input or output. It can be thrown by most classes in the java.io package for many reasons to prevent …

  5. Difference between java.lang.RuntimeException and java.lang.Exception ...

    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 - When to choose checked and unchecked exceptions - Stack …

    The Java core API fails to follow these rules for SQLException (and sometimes for IOException) which is why they are so terrible. Checked Exceptions should be used for predictable, but unpreventable …

  7. java - Mockito How to mock and assert a thrown exception ... - Stack ...

    I'm using mockito in a junit test. How do you make an exception happen and then assert that it has (generic pseudo-code)

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

    Apr 28, 2011 · Do note that recovery from a RuntimeException is generally possible but the guys who designed the class/exception deemed it unnecessary for the end programmer to check for such …

  9. java - Difference between e.getMessage () and e.getLocalizedMessage ...

    Jul 28, 2014 · Java Exceptions inherit their getMessage and getLocalizedMessage methods from Throwable (see the related link). The difference is that subclasses should override …

  10. 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 org.mockito.Mockito.verify with various …