Checked exceptions are a failed expriment in language design. They force you to have extremely leaky abstractions and dirty code. They should be avoided as much as possible.

As for your points:

1) Checked exceptions make the code dirty, and no less unpredictable because they show up everywhere.

2) How is a checked exception being shown to the user any better? The only real difference between checked and unchecked exceptions is technical and affects only the source code.

3) Ever heard of stack traces? They tell you exactly where the exception was thrown, no matter whether it's checked or unchecked. Actually, checked exceptions tend to be worse for debugging because they're often wrapped which leads to longer and uglier stack traces, or even lost atogether because the wrapping was done wrong.

There are two kinds of exceptions: those that occur "normally" and are typically handled very close to where they occur, and those that are reallly exceptional and can be handled generically in a very high layer (just abort the current action and log it / show an error).

Checked exceptions were an attempt to put this distinction into the language syntax at the point the exceptions are defined. The problems with this are

  • The distinction is really up to the caller, not the code that throws the exception
  • It's completely orthogonal to the semantic meaning of an exception, but tying it to the class hierarchy forces you to mix the two
  • The whole point of exceptions is that you can decide at what level to catch them without risking to lose an error silently or having to pollute the code at intermediate levels or ; checked exceptions lose that second advantage.
Answer from Michael Borgwardt on Stack Exchange
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › lang › RuntimeException.html
RuntimeException (Java Platform SE 8 )
October 20, 2025 - RuntimeException is the superclass of those exceptions that can be thrown during the normal operation of the Java Virtual Machine. RuntimeException and its subclasses are unchecked exceptions. Unchecked exceptions do not need to be declared in a method or constructor's throws clause if they ...
🌐
TutorialsPoint
tutorialspoint.com › how-to-handle-the-runtime-exception-in-java
How to handle the Runtime Exception in Java?
The error that occurs at runtime after successful compilation of the Java program is called a runtime error or unchecked exception. It disrupts the normal flow of a program's execution and terminates the program abruptly. These errors are not detected by the compiler but by JVM.
Discussions

Difference between java.lang.RuntimeException and ...
Whereas checked exceptions are ... and are instead required to deal with them after the fact. (And yes, since not everyone agrees with the concept of checked exceptions and many people use RuntimeException for everything, this distinction has become a bit muddled). 2014-11-07T08:22:23.683Z+00:00 ... Nowadays people favor unchecked RuntimeException also, because it is compatible to Java 8 Lambda ... More on stackoverflow.com
🌐 stackoverflow.com
Can you add throws RuntimeException to method signature?
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
4
8
November 20, 2022
java - Is it not a good practice to handle runtime exceptions in the code? - Software Engineering Stack Exchange
A catch-all exception (that WILL handle the situation gracefully, not just return null;) will be a better solution. SF. – SF. 2011-07-11 13:26:03 +00:00 Commented Jul 11, 2011 at 13:26 · You probably are confusing java with something else (C++ for exemple). When an allocation fails, you get an OutOfMemoryError or something similar, never a null pointer. Hidding a null return instead ... More on softwareengineering.stackexchange.com
🌐 softwareengineering.stackexchange.com
Java runtime error 'EXCEPTION_ACCESS_VIOLATION (0xc0000005)'

A fatal error has been detected by the Java Runtime Environment:

EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ff8249dd9ac, pid=6056, tid=6308

JRE version: Java(TM) SE Runtime Environment (8.0_25-b18) (build 1.8.0_25-b18) Java VM: Java HotSpot(TM) 64-Bit Server VM (25.25-b02 mixed mode windows-amd64 compressed oops) Problematic frame: C [ig75icd64.dll+0x55d9ac]

Failed to write core dump. Minidumps are not enabled by default on client versions of Windows

An error report file with more information is saved as: C:\Users\edthr\AppData\Roaming.minecraft\hs_err_pid6056.log

If you would like to submit a bug report, please visit: http://bugreport.sun.com/bugreport/crash.jsp The crash happened outside the Java Virtual Machine in native code. See problematic frame for where to report the bug.

Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release

More on reddit.com
🌐 r/Minecraft
3
0
April 3, 2015
Top answer
1 of 5
13

Checked exceptions are a failed expriment in language design. They force you to have extremely leaky abstractions and dirty code. They should be avoided as much as possible.

As for your points:

1) Checked exceptions make the code dirty, and no less unpredictable because they show up everywhere.

2) How is a checked exception being shown to the user any better? The only real difference between checked and unchecked exceptions is technical and affects only the source code.

3) Ever heard of stack traces? They tell you exactly where the exception was thrown, no matter whether it's checked or unchecked. Actually, checked exceptions tend to be worse for debugging because they're often wrapped which leads to longer and uglier stack traces, or even lost atogether because the wrapping was done wrong.

There are two kinds of exceptions: those that occur "normally" and are typically handled very close to where they occur, and those that are reallly exceptional and can be handled generically in a very high layer (just abort the current action and log it / show an error).

Checked exceptions were an attempt to put this distinction into the language syntax at the point the exceptions are defined. The problems with this are

  • The distinction is really up to the caller, not the code that throws the exception
  • It's completely orthogonal to the semantic meaning of an exception, but tying it to the class hierarchy forces you to mix the two
  • The whole point of exceptions is that you can decide at what level to catch them without risking to lose an error silently or having to pollute the code at intermediate levels or ; checked exceptions lose that second advantage.
2 of 5
2

My view is that what type of exception is thrown is dependant on what your code is doing.

I throw checked exceptions when I expect they can happen quite often (users entering dodgy data for example) and I expect the calling code to handle the situation.

I throw unchecked/runtime exceptions (not as often as checked) when I have a rare situation which I do not expect the calling code to handle. An example might be some sort of weird memory related error which I never expect to occur. Unchecked are the sorts of errors that you expect to bring down the application.

No exception should appear in front of a user without some level of support. Even if it's just a "please cut and paste this error dump to an email". Nothing is more annoying to a user than being told there is an error, but being given no details or action they can take to initiate it being fixed.

My guess is that the philosophy you mention comes from one of two sources:

  • Lazy programmers trying to avoid doing work.
  • Or developers who have had to support code which went the other way. i.e. over-error-handling. The sort of code that contains large amounts of exception handling, much of which does nothing, or even worse, is used for flow control and other incorrect purposes.
🌐
TheServerSide
theserverside.com › tip › Fix-these-10-common-examples-of-the-RuntimeException-in-Java
Fix these 10 common examples of the RuntimeException in Java | TheServerSide
The ArrayStoreException shares similarities with the ClassCastException. This Java runtime exception happens when the wrong type of object is placed into an array.
Published   March 16, 2022
🌐
Rollbar
rollbar.com › home › what does java.lang.runtimeexception mean?
What does java.lang.RuntimeException mean? | Rollbar
July 24, 2024 - This error is then caught in the ... must be handled explicitly, while a RuntimeException represents unchecked exceptions that do not require explicit handling....
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › api › java.lang.runtimeexception
RuntimeException Class (Java.Lang) | Microsoft Learn
RuntimeException is the superclass of those exceptions that can be thrown during the normal operation of the Java Virtual Machine. RuntimeException and its subclasses are <em>unchecked exceptions</em>. Unchecked exceptions do <em>not</em> need ...
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)
🌐
Medium
medium.com › thefreshwrites › the-most-common-java-runtime-errors-b6bc49a7716e
The Most Common Java Runtime Errors | by Mouad Oumous | The Fresh Writes | Medium
February 22, 2024 - Since the NegativeArraySizeException is an unchecked exception (extends RuntimeException), it does not need to be declared in the throws clause of a method or constructor. Developers must set array size to a positive integer. If a minus sign slips into the array size declaration, this throws the NegativeArraySizeException. class JavaError { public static void main(String[] args) { int[] arr = new int[-5]; // Negative size of the array arr[8] = 89; System.out.println("Something went wrong!"); } }
🌐
Quora
quora.com › Why-is-it-generally-considered-bad-practice-to-throw-a-RuntimeException-in-Java
Why is it generally considered bad practice to throw a RuntimeException in Java? - Quora
Answer (1 of 2): TL;DR = it’s all about use cases and severity. “Good” or “bad” practice is all about guidelines, they’re not a replacement for *thinking* about a solution. It’s only bad practice IF the code stack above the method throwing the exception should be able to respond ...
🌐
Princeton
cs.princeton.edu › courses › archive › spr96 › cs333 › java › tutorial › java › exceptions › runtime.html
Runtime Exceptions--The Controversy
Because the Java language does not require methods to catch or declare runtime exceptions, it's tempting for programmers to write code that throws only runtime exceptions or make all of their exception subclasses inherit from RuntimeException.
🌐
Oracle
docs.oracle.com › javase › 6 › docs › api › java › lang › RuntimeException.html
RuntimeException (Java Platform SE 6)
RuntimeException is the superclass of those exceptions that can be thrown during the normal operation of the Java Virtual Machine. A method is not required to declare in its throws clause any subclasses of RuntimeException that might be thrown during the execution of the method but not caught.
🌐
GeeksforGeeks
geeksforgeeks.org › java › java-program-to-handle-runtime-exceptions
Java Program to Handle Runtime Exceptions - GeeksforGeeks
July 23, 2025 - RuntimeException is the superclass of all classes that exceptions are thrown during the normal operation of the Java VM (Virtual Machine). The RuntimeException and its subclasses are unchecked exceptions.
🌐
Reddit
reddit.com › r/javahelp › can you add throws runtimeexception to method signature?
r/javahelp on Reddit: Can you add throws RuntimeException to method signature?
November 20, 2022 -

I'm studying java at school my professor gave us an exercise where you have to create a method whose signature is: "public static double calculates(double o1, double o2, char op) throws InputMismatchException". I'm studying exceptions online and I found some sites that tell you you shouldn't add throws RuntimeException because the problem isn't handled the same way. I'm too afraid to ask my professor because that would be implying e taught us wrong all the time.

Top answer
1 of 3
5
You usually don't add a throws RuntimeException to the method signature, tha'ts the whole point of handling a RuntimeException (however you should add it in your javadoc with a @throws MyException blahblah). You let the exception goes up to the layer handling your exception. However your prof may want you for educational purpose to put it explicitely. Why not.
2 of 3
2
There are two kinds of exceptions: checked and unchecked. Checked exceptions require the compiler to check that your method has handled the exception. You can either do that with a catch block in your method or you can use a throws clause in your method signature to explicitly tell the compiler that your method is handing off that responsibility to the code that calls it. Since that is the only use for throws clauses, it's useless and misleading to use throws for unchecked exceptions, so no one does it. Instead, you write a Javadoc just above the method signature that includes information like the documentation for the nextInt() method of Scanner . At the end there, it has a list of any checked or unchecked exceptions it can throw. You can see what they typed in to get it to show up like that in the OpenJDK 8 source code for Scanner . To answer your question, throws RuntimeException and throws InputMismatchException have two different meanings. The first states that RuntimeException and all its subclasses including InputMismatchException might be thrown. The second states that only InputMismatchExceptions will be thrown. But they both have an identical effect, since unchecked exceptions do nothing there. The easiest way to figure out whether you need to use throws is if the compiler gives you an error about not handling a checked exception. The second easiest way is to look up the documentation by googling inputmismatchexception 8 api (replace 8 with your Java version), then click the link near the top that comes from docs.oracle.com. Near the top of that documentation , it lists the superclasses of InputMismatchException, two of which are Exception and RuntimeException. That means it's unchecked. If it only has Exception, then it's a checked exception.
🌐
Coderanch
coderanch.com › t › 499993 › java › difference-error-runtime-exception
difference between error and runtime exception (Java in General forum at Coderanch)
June 21, 2010 - Runtime exception are those condition which occurs when the program is running and some thing goes wrong e.g. ArrayOutOfBoundException when its elements exceede Array size. So this exceptions can be handled through Exception Handling. Error is a condition which cannot be handled by our program ...
🌐
Quora
quora.com › How-do-you-handle-runtime-exception
How to handle runtime exception - Quora
Answer: This is an extremely difficult questions to answer accurately. This may depend on a number of different parameters. I will list a few important ones. 1. How exceptional is the exception and how common are checked exceptions in your code base? 2. What is the purpose of the code? 3. Can it...
🌐
Oracle
docs.oracle.com › en › java › javase › 17 › docs › api › java.base › java › lang › RuntimeException.html
RuntimeException (Java SE 17 & JDK 17)
October 20, 2025 - RuntimeException is the superclass of those exceptions that can be thrown during the normal operation of the Java Virtual Machine. RuntimeException and its subclasses are unchecked exceptions. Unchecked exceptions do not need to be declared in a method or constructor's throws clause if they ...
🌐
Oracle
docs.oracle.com › en › java › javase › 22 › docs › api › java.base › java › lang › RuntimeException.html
RuntimeException (Java SE 22 & JDK 22)
July 16, 2024 - RuntimeException is the superclass of those exceptions that can be thrown during the normal operation of the Java Virtual Machine. RuntimeException and its subclasses are unchecked exceptions. Unchecked exceptions do not need to be declared in a method or constructor's throws clause if they ...
🌐
Stackify
stackify.com › types-of-exceptions-java
Types of Exceptions in Java - Stackify
March 14, 2024 - Hence they are also referred to as Runtime exceptions. These exceptions are generally ignored during the compilation process. They are not checked while compiling the program. For example, programming bugs like logical errors, and using incorrect APIs. To illustrate the concept of an unchecked exception, let us consider the following code snippet: import java.util.Scanner; public class Sample_RunTimeException { public static void main(String[] args) { // Reading user input Scanner input_dev = new Scanner(System.in); System.out.print("Enter your age in Numbers: "); int age1 = input_dev.nextInt(); if (age1>20) { System.out.println("You can view the page"); } else { System.out.println("You cannot view the page"); } } }