Top "Checked-exceptions" questions

The exceptions that need to be declared in a method or constructor's `throws` clause if they can be thrown by the execution of the method or constructor and propagate outside the method or constructor boundary.

Throw checked exceptions

A few of my methods in Java throw exceptions such as NoSuchElementException, IllegalArgumentException, etc. But when using these methods, these …

java exception exception-handling checked-exceptions
Checked vs Unchecked exception

I've studied that: With an unchecked exception, however, the compiler doesn't force client programmers either to catch the exception or …

java exception runtimeexception checked-exceptions
How to identify checked and unchecked exceptions in java?

While reading about exception, I will always come across checked exceptions and unchecked exceptions, So wanted to know how to …

java exception-handling checked-exceptions unchecked-exception
Custom Exception that wraps Multiple Exceptions : Encouraged or Not?

I am coding a Java Library that will be used to access a DB. I am throwing the exceptions to …

java jar exception-handling checked-exceptions
declare a method always throws an exception?

I have a method like... int f() { try { int i = process(); return i; } catch(Exception ex) { ThrowSpecificFault(ex); } } This produces …

c# .net exception exception-handling checked-exceptions
Throwing exception from lambda

Given this java 8 code public Server send(String message) { sessions.parallelStream() .map(Session::getBasicRemote) .forEach(basic -> { try { basic.…

java error-handling lambda java-8 checked-exceptions
How to wrap checked exceptions but keep the original runtime exceptions in Java

I have some code that might throw both checked and runtime exceptions. I'd like to catch the checked exception and …

java runtimeexception checked-exceptions
Guava cache and preserving checked exceptions

I'm refactoring some code to use guava Cache. Initial code: public Post getPost(Integer key) throws SQLException, IOException { return PostsDB.…

java caching exception-handling guava checked-exceptions
Getting Mockito Exception : checked exception is invalid for this method

I have a method which I am trying to test public List<User> getUsers(String state) { LOG.debug("…

java junit mockito checked-exceptions
Types of Exception in Java

I am confused about types of exceptions in Java. On many tutorial websites I have seen that two types of …

java exception checked-exceptions