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
🌐
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.
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
My personal definitive guide to (java) Exceptions
I finally went on and wrote what i felt like i had to say in the context of exceptions. Since it's such a debated topic, i fully expect some negative backlash, and i have no problem with it, everybody is entitled to their opinion! Let me know if you find it somehow useful. More on reddit.com
🌐 r/java
62
41
January 4, 2021
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 28, 2024
If everyone hates checked exceptions, where's the alternative?
What you're observing is that for any endeavor, the haters often dominate the discourse, even when they don't have a majority position or a credible alternative. If they didn't hate on exceptions, they'd be whining about something else. Error handling is hard; there are many different approaches (C-style single return codes, Go-style multiple return codes, unchecked exceptions, checked exceptions, try monads, and more), and each has their pros and cons (and their supporters and haters), striking different balances of reliability and intrusiveness. Thinking there is One True Best Way here is fantasy. When people react to a particular error model, they are often reacting not to the approach itself, but examples they've encountered where it is used poorly. (Certainly Java has no shortage of examples of checked exceptions being misused.) The reality is that checked exceptions are OK, and they're what we've got, and, even if there was something that was slightly better, the disruption of trying to migrate billions of lines of code would make that impractical -- it would have to be massively better, and there's no such candidate on the horizon. Most developers intuitively realize this, and are not interested in dying on this hill, so you don't hear them in the vocal discourse, because they're too busy getting their work done. So if you want to know what to tell the newbies, tell them: don't take every rant seriously, some people just like to rant. More on reddit.com
🌐 r/java
93
16
April 25, 2024
🌐
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.
🌐
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 ·
🌐
j-labs
j-labs.pl › home › tech blog › java exception handling: strategies and best practices
Java Exception Handling in Java Best Practices | j‑labs
October 9, 2025 - Java’s exception handling mechanism ... categorized into three main types based on their origin and behavior: checked exceptions, unchecked exceptions, and errors....
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › lang › Exception.html
Exception (Java Platform SE 8 )
October 20, 2025 - Constructs a new exception with the specified detail message, cause, suppression enabled or disabled, and writable stack trace enabled or disabled. ... cause - the cause. (A null value is permitted, and indicates that the cause is nonexistent or unknown.) enableSuppression - whether or not suppression is enabled or disabled · writableStackTrace - whether or not the stack trace should be writable ... Java™ Platform Standard Ed.
🌐
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)
Find elsewhere
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.

🌐
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
🌐
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 ...
🌐
Rollbar
rollbar.com › home › how to throw exceptions in java
How to Throw Exceptions in Java | Rollbar
2 weeks ago - There are two types of exceptions in Java: checked (compile time) exceptions and unchecked (runtime) exceptions.
🌐
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); } }
🌐
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...
🌐
GeeksforGeeks
geeksforgeeks.org › java › exceptions-in-java
Java Exception Handling - GeeksforGeeks
Built-in Exception are pre-defined exception classes provided by Java to handle common errors during program execution. There are two type of built-in exception in java.
Published   1 month ago
🌐
Scaler
scaler.com › topics › types-of-exception-in-java
Types of Exception in Java - Scaler Topics
November 7, 2022 - Built-in Exceptions are those exceptions that are pre-defined in Java Libraries. These are the most frequently occurring Exceptions. An example of a built-in exception can be ArithmeticException; it is a pre-defined exception in the Exception class of java.lang package. These can be further divided into two types:
🌐
Hero Vired
herovired.com › home › learning-hub › blogs › types-of-exception-in-java
Types of Exception in Java with Examples | Hero Vired
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.
🌐
Oracle
docs.oracle.com › javase › specs › jls › se17 › html › jls-11.html
Chapter 11. Exceptions
September 16, 2025 - It is the body of a lambda expression, containing expressions and statements, that can throw exception classes. A throw statement (§14.18) whose thrown expression has static type E and is not a final or effectively final exception parameter can throw E or any exception class that the thrown expression can throw. For example, the statement throw new java.io.FileNotFoundException(); can throw java.io.FileNotFoundException only.
🌐
Sematext
sematext.com › home › blog › exception handling in java: how-to tutorial with examples & best practices
How to Handle Exceptions in Java: Tutorial with Examples
Yoast SEO for WordPress
Yoast SEO is the most complete WordPress SEO plugin. It handles the technical optimization of your site & assists with optimizing your content.
Price   $69.00
🌐
Tutorialspoint
tutorialspoint.com › java › java_builtin_exceptions.htm
Java - Built-in Exceptions
Java defines several exception classes inside the standard package java.lang. The most general of these exceptions are subclasses of the standard type RuntimeException.
🌐
Rollbar
rollbar.com › home › most common java exceptions
Most Common Java Exceptions | Rollbar
November 28, 2022 - For instance, if a program attempts to access a file that is currently unavailable, the method to access the file must either catch or throw a FileNotFoundException. Error - errors are exceptions that happen externally to your Java program. One common example of the error is when the Java virtual machine (JVM) runs out of memory, which will throw an OutOfMemoryError.