There are 3 types of Throwables in Java.

  • Checked Exceptions (Exception and down the chain, save for RuntimeException). These are checked by the compiler and must be caught when thrown. They represent an exceptional condition that is usually recoverable, e.g. when a referenced file is not found on the file system (see FileNotFoundException).
  • Unchecked or runtime Exceptions (children of RuntimeException). These can be thrown without catching. They typically represent programming errors, for instance invoking methods on a null object (see NullPointerException).
  • Errors. These are unchecked as well. They are thrown by the JVM when something very wrong is happening, typically beyond the developer's direct control (e.g. out of memory, see OutOfMemoryError). Compiler errors are issued by the Java compiler when your code fails to compile, for various reason such as bad syntax, ambiguous calls, failing to catch a checked Exception, etc. etc.
Answer from Mena on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › java › types-of-exception-in-java-with-examples
Types of Exception in Java with Examples - GeeksforGeeks
July 23, 2025 - The following program illustrates how to create your own exception class MyException. Details of account numbers, customer names, and balance amounts are taken in the form of three arrays. In main() method, the details are displayed using a for-loop. At this time, a check is done if in any account the balance amount is less than the minimum balance amount to be apt in the account. If it is so, then MyException is raised and a message is displayed “Balance amount is less”. ... // Java program to demonstrate user defined exception // This program throws an exception whenever balance // amoun
🌐
Stackify
stackify.com › types-of-exceptions-java
Types of Exceptions in Java - Stackify
March 14, 2024 - Learn about the different types of exceptions in Java (checked and unchecked) and see specific examples.
Discussions

Types of Exception in Java - Stack Overflow
I am confused about types of exceptions in Java. On many tutorial websites I have seen that two types of exception are there in java Compile time exception Run time exception But when I talked wit... More on stackoverflow.com
🌐 stackoverflow.com
Exception handling in Java: Advanced features and types
The article has some errors. And not the throwable kind, heh: If not found, it unwinds the method-call stack looking for the closest catch block that can handle the exception. If not found, the JVM terminates with a suitable message. You can see this action in Listing 1. The part in italics is incorrect! What happens if there is no catch block that is suitable is that the thread exits and passes the exception that was never caught to the thread's uncaught exception handler. And that's that. The thread is done. By default, each thread starts with an uncaught exception handler that simply prints the exception to syserr (e.printStackTrace(); - that's the whole body, that's all). At no point does it ever exit a JVM. Of course, if you have a java app that never starts any threads, then the main thread is the only relevant thread, and if that exits due to an exception bubbling all the way up, yeah, sure, the JVM then exits as no non-daemon threads are running. But it feels ridiculous to handwave this away as 'oh we are just trying to keep it simple'. "The thread dies" is just as simple and much more accurate. You can invoke printStackTrace() directly, typically from a catch block. For example, consider a second version of the PrintStackTraceDemo application. This entire article keeps making pointless and misleading sidenotes. For example, it sidenotes 'you can also call printStackTrace(somePrintWriter) which is weird to mention; anybody can look at the API docs and discover this, and it's not like they're covering the entire API here. It's like I'm pointing out all the interesting aspects of the Mona Lisa and then casually remark: "Oh, look, someone dropped a candy wrapper over there. Anyway, moving right along..." - it's just bizarre to mention this. It strongly insinuates that this is important. And that then blows up thoroughly in the quoted section: Newbies are legendary in writing catch blocks with e.printStackTrace(); in it which is a massive anti-pattern that is difficult to eradicate. And this blog post is making it worse by using it as a way to explain that you can invoke printStackTrace yourself (not an important lesson!) without explaining that you shouldn't do that or that this contrived example shouldn't be taken as an insinuation of: "Ah, and this is how you write your standard catch block". Try-with-resources Another example that is fucking horrible. You don't deal with IOExceptions thrown by close() methods by ignoring them!! streams buffer. Any exception thrown by a close() method means the entire write operation has likely failed. If you treat them differently than any exception that would have been thrown by the most recent write call you wrote a hard-to-test for bug (i.e: A really really bad bug). But that isn't obvious here. It's again teaching extremely bad patterns. Listing 8. Copy.java No, the right way to deal with exceptions thrown here is to just declare your main method as throws Exception which you should almost always do. Writing a catch block that tosses most of the useful info in the garbage (as in this snippet, the exception's type which might be FileAccessDeniedException or whatnot - the key info, you toss that away!), then just writes something and blindly continues with the app is ON ERROR RESUME NEXT level stupidity. Common stupidity, but that shouldn't be an excuse. On the contrary, given that the common-ness has proven that your average new java programmer will readily misunderstand, you should go out of your way not to perpetuate this mistake. As is, this article should be torched with a flamethrower: If you send this to new java programmers and they read it, they'll be stupider after having read it than before. The article is fixable though. Come up with less 'actively perpetuating really stupid anti-patterns' examples, stop trying to be opinion-less (because the chosen examples and focus invoke an opinion, whether you intended it or not, and right now it's invoking the wrong ones), and cut some of the irrelevant chaff such as how to make your own stack trace (not relevant for an intro article in any way and actively misleads in suggesting that it is somehow an important tool one should be using often) and mentioning irrelevant parts of the API. More on reddit.com
🌐 r/java
9
17
May 30, 2024
How do you structure your exception classes?
On July 1st, a change to Reddit's API pricing will come into effect. Several developers of commercial third-party apps have announced that this change will compel them to shut down their apps. At least one accessibility-focused non-commercial third party app will continue to be available free of charge. If you want to express your strong disagreement with the API pricing change or with Reddit's response to the backlash, you may want to consider the following options: Limiting your involvement with Reddit, or Temporarily refraining from using Reddit Cancelling your subscription of Reddit Premium as a way to voice your protest. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
🌐 r/java
33
44
January 17, 2024
Why do we need to catch specific exceptions instead of just catching any Exception?
Please ensure that: Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions You include any and all error messages in full You ask clear questions You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions. Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar If any of the above points is not met, your post can and will be removed without further warning. Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://imgur.com/a/fgoFFis ) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc. Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit. Code blocks look like this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above. If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures. To potential helpers Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
🌐 r/javahelp
11
17
June 30, 2021
🌐
W3Schools
w3schools.com › java › java_ref_errors.asp
Java Error and Exception Types Reference
Java Examples Java Compiler Java Exercises Java Quiz Java Server Java Syllabus Java Study Plan Java Interview Q&A Java Certificate · ❮ Previous Next ❯ · The table below shows a list of common Error and Exception types in Java: Java Errors Tutorial · Java Exception Handling Tutorial ·
Top answer
1 of 7
8

There are 3 types of Throwables in Java.

  • Checked Exceptions (Exception and down the chain, save for RuntimeException). These are checked by the compiler and must be caught when thrown. They represent an exceptional condition that is usually recoverable, e.g. when a referenced file is not found on the file system (see FileNotFoundException).
  • Unchecked or runtime Exceptions (children of RuntimeException). These can be thrown without catching. They typically represent programming errors, for instance invoking methods on a null object (see NullPointerException).
  • Errors. These are unchecked as well. They are thrown by the JVM when something very wrong is happening, typically beyond the developer's direct control (e.g. out of memory, see OutOfMemoryError). Compiler errors are issued by the Java compiler when your code fails to compile, for various reason such as bad syntax, ambiguous calls, failing to catch a checked Exception, etc. etc.
2 of 7
4

Any "famous website" that said that should not be read. It is rubbish. There is no such thing as a "compile time exception". The Java Geeks you were talking to are correct1.

Actually, you probably misread or misunderstood what you read on those "famous sites". There are "compile time ERRORS" and "run time EXCEPTIONS".

In your example, what you have is a couple of compile time error message, that are due to errors in your code. The errors are there because your code does not handle exceptions correctly, but they are ERRORS nonetheless. And they are detected at compile time ... by the Java compiler.


1 ... and maybe it is time to stop using semi-derogatory labels like "geek" for them. It sounds like they deserve some respect.

🌐
Educative
educative.io › answers › what-are-different-types-of-exceptions-in-java
What are different types of exceptions in Java?
The table below represents some of the commonly used unchecked exception classes in Java with their description. The Error class represents the serious problems that cause the program to abort. They include out of memory error, stack overflow error, and so on. Now, let's see different types of ...
🌐
Scaler
scaler.com › topics › types-of-exception-in-java
Types of Exception in Java - Scaler Topics
February 27, 2024 - The IOException is a frequently encountered exception in programming, typically arising from input or output discrepancies. It indicates a failure or interruption in input-output operations and can be handled using "throws" or will result in a compile-time error if not addressed. ... The possible exception of type java.io.FileNotFoundException needs to be handled.
🌐
Vlabs
java-iitd.vlabs.ac.in › exp › exceptions › theory.html
Exception Handling in Java - Virtual Labs
statement 6 to 10 will not be executed. If we perform exception handling, the rest of the statement will be executed. That is why we use exception handling in Java. There are mainly two types of exceptions: checked and unchecked. Here, an error is considered as the unchecked exception.
Find elsewhere
🌐
Raygun
raygun.com › blog › java-exceptions-terminology
Java exceptions: Common terminology with examples · Raygun Blog
October 25, 2022 - Remember that the compiler had no complaints in the case of unchecked exceptions, as they will be thrown only at runtime. If I proceed with the unhandled exception the compiler returns the following error message: Exception in thread "main" java.lang.Error: Unresolved compilation problems: Unhandled exception type IOException Unhandled exception type IOException Unhandled exception type IOException at fileNotFound.FileNotFound.main(FileNotFound.java:8)
🌐
ThoughtCo
thoughtco.com › types-of-exceptions-2033910
Three Types of Exceptions in Java
July 3, 2019 - There are three types of exception—the checked exception, the error and the runtime exception. Checked exceptions are exceptions that a Java application should be able to cope with.
🌐
Rollbar
rollbar.com › home › java exceptions hierarchy explained
Java Exceptions Hierarchy Explained | Rollbar
May 15, 2025 - Exception in thread "main" java.lang.NullPointerException at IOExceptionExample.writeToFile(IOExceptionExample.java:10) at IOExceptionExample.main(IOExceptionExample.java:17) As mentioned, since NullPointerException is an unchecked exception, it did not need to be handled in code - only the checked exception (IOException) was handled. While understanding the exception hierarchy is important, how you use exceptions in your code matters even more. Consider these key practices: Be specific with exception types - catch the most specific exception possible rather than using catch-all blocks
🌐
JetBrains
blog.jetbrains.com › idea › 2024 › 03 › easy-hacks-how-to-throw-java-exceptions
Easy Hacks: How to Throw Java Exceptions | The IntelliJ IDEA Blog
March 12, 2024 - Another example is NullPointerException, which may be thrown when a variable that is not pointing to any object (and refers to nothing, or null) is accessed. In Java, there are two types of exceptions: checked and unchecked.
🌐
Quora
quora.com › What-are-the-types-of-exceptions-in-Java
What are the types of exceptions in Java? - Quora
It is an object which is thrown at runtime. Types of Exception There are mainly two types of exceptions: checked and unchecked where error is considered as unchecked exception. The sun microsystem say...
🌐
Hero Vired
herovired.com › home › learning-hub › blogs › types-of-exception-in-java
Types of Exception in Java with Examples | Hero Vired
January 11, 2025 - These types of exceptions in Java are predefined within Java libraries. These types of exceptions in Java occur most frequently. You can consider an Arithmetic Exception in this category. This predefined exception is found in the Java.lang.package.
🌐
Baeldung
baeldung.com › home › java › core java › common java exceptions
Common Java Exceptions | Baeldung
January 8, 2024 - When a program evaluates an arithmetic operation and it results in some exceptional condition, it throws ArithmeticException. In addition, ArithmeticException applies to only int and long data types. For instance, if we try to divide an integer by zero, we get an ArithmeticException: int illegalOperation = 30/0; // Throws ArithmeticException · Java allows typecasting between the objects in order to support inheritance and polymorphism.
🌐
Tutorialspoint
tutorialspoint.com › java › java_exceptions.htm
Java - Exceptions
These exceptions cannot simply be ignored, the programmer should take care of (handle) these exceptions. For example, if you use FileReader class in your program to read data from a file, if the file specified in its constructor doesn't exist, then a FileNotFoundException occurs, and the compiler prompts the programmer to handle the exception. import java.io.File; import java.io.FileReader; public class FilenotFound_Demo { public static void main(String args[]) { File file = new File("E://file.txt"); FileReader fr = new FileReader(file); } }
🌐
Study.com
study.com › computer programming › programming languages › compiled languages › java (programming language)
Exceptions in Java: Definition & Example | Study.com
November 26, 2024 - If you do nothing to handle (catch) these exceptions, Java will nicely tell you that you've hit a File Not Found exception. But your program will still terminate! If there is nothing to 'catch' this error, the program crashes. This type of exception is an unhandled exception. The code that handles the error is called the 'exception handler', and is the code that catches the exception. As we'll see in our code, the actual Java keywords are 'try' and 'catch'.
🌐
Slideshare
slideshare.net › slideshow › types-of-exceptions › 16974209
Types of exceptions | PPT
Type of Exceptions •There are two types of exceptions in Java • Unchecked exceptions • Checked exceptions http://improvejava.blogspot.in/ 9CM604.46 8
🌐
LinkedIn
linkedin.com › pulse › java-exception-handling-part-i-exceptions-its-types-alphadot-tech
Java Exception Handling - Part I (Exceptions and its types)
August 17, 2023 - However, according to Oracle, there are three types of exceptions namely: ... NOTE:- Runtime and Unchecked exceptions refer to the same thing. We often use them interchangebly. ... Checked Exceptions are exceptions that the JAVA complier requires ...
🌐
ScholarHat
scholarhat.com › home
What is Exception Handling in Java?: try, catch, throw, finally
When learning Java, one must be ... a technique for handling different types of errors, such as File Not Found Exceptions, IO Exceptions, Class Not Found Exceptions, etc....
Published   September 9, 2025
🌐
Pluralsight
pluralsight.com › blog › software development
How to handle the 10 most common exceptions in Java | Online Courses, Learning Paths, and Certifications - Pluralsight
July 17, 2024 - Because the caller is passing in an invalid value, Spring’s Assert class throws an IllegalArgumentException. To repair it, follow the instructions outlined in the exception message. One rather curious instance of IllegalArgumentException is when the Java runtime version is lower than the compiler version.