> For the complete documentation index, see [llms.txt](https://dev7days.gitbook.io/dev7days/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dev7days.gitbook.io/dev7days/java/check-vs-unchecked-exception.md).

# Check vs Unchecked Exception

Check Exception is verified at run time so we will need to add `throws` on method.

**Example**

```java
// Example Exception
1. IOException
2. SqlException

public void insert(User user) throws SqlException {
    // If we don't want to try catch then we must to add `throws` keyword.
    jdbcTemplate.update(user,new UserMapper());                                
}
```

For Unchecked Exception, developer is the person who verify it by using `try-catch`  or ignore verifying .&#x20;

**Example**

```java
// Example Exception
1. NullPointerException
2. RuntimeException
3. ArithmeticException

// Requuest can be null
public void createUser(CreateUserRequest createUserRequest){
    try {
        String username = createUserRequest.getUserName();
    }catch(NullPointerException ex){
         throw new BusinessException("Request is null");   
    }        
}
```
