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.
🌐
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.
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.

🌐
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 ·
🌐
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 ...
🌐
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)
🌐
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:
Find elsewhere
🌐
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   December 23, 2016
🌐
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); } }
🌐
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.
🌐
W3Resource
w3resource.com › java-tutorial › types-of-exception.php
Types of Exceptions - w3resource
Checked exceptions are the type that programmers should anticipate and from which programs should be able to recover. All Java exceptions are checked exceptions except those of the Error and RuntimeException classes and their subclasses.
🌐
Hero Vired
herovired.com › home page › blogs › types of exception in java with examples | hero vired
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.
🌐
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
🌐
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.
🌐
Pluralsight
pluralsight.com › blog › software development
How to handle the 10 most common exceptions in Java | Online Courses, Learning Paths, and Certifications - Pluralsight
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.
🌐
W3Schools
w3schools.com › java › java_try_catch.asp
Java Exceptions (Try...Catch)
The throw statement is used together with an exception type. There are many exception types available in Java: ArithmeticException, FileNotFoundException, ArrayIndexOutOfBoundsException, SecurityException, etc:
🌐
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.
🌐
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...
🌐
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.