Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8883063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:43:30+00:00 2026-06-14T20:43:30+00:00

It is sayed that the run does’t throw Handled Exceptions. JVM simply ignores them.

  • 0

It is sayed that the run does’t throw Handled Exceptions. JVM simply ignores them. So I threw UnHandled Exception (ArithmeticException). But the same thing happened for it as well.
I know that it is rediculous to try to catch the excpetion from a thread that has been started by the catch clause marked as XXX. Because the excution may already passed that line.

But I wanna know why java allows run to throw Unhanlded Exception while restricting Handled ones and what is happening additionally when run() throwing Unhandled Exception?

Parent Thread

public class Parent {

    public static void main(String[] args) {

        Child   child   = new Child();
        Thread chThread = new Thread(child);

        try {
            chThread.start();

        } catch (Exception e) { // XXX mark
            System.err.println("XXX");
            e.printStackTrace();
        }

    }

Child Thread

public class Child implements Runnable {

    @Override
    public void run() throws ArithmeticException{
            method0(); // line 8
    }

    public void method0(){
        int i = 0/0; // line 12
    }
}

java.lang.Thread

public class Thread implements Runnable {
    public void run() {
    if (target != null) {
        target.run(); // line 619
    }
    }
}

StackTrace

Exception in thread "Thread-0" java.lang.ArithmeticException: / by zero
    at seperateStacksPerThread.Child.method0(Child.java:12)
    at seperateStacksPerThread.Child.run(Child.java:8)
    at java.lang.Thread.run(Thread.java:619)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:43:31+00:00Added an answer on June 14, 2026 at 8:43 pm

    The signature of run() does not include a checked exception. As a result you can not override it to throw a checked exception (when you override you can never be more restrictive).
    But throwing an unchecked exception is allowed as it is not part of the signature (no one is required to catch it).
    When you throw the arithmetic exception it is part of the stack trace of a different thread.
    Notice that it says:

    Exception in thread "Thread-0" java.lang.ArithmeticException: / by zero

    And not: Exception in thread "main" java.lang.ArithmeticException: / by zero

    Now why are checked exceptions not allowed, it is a design decision and I think it is because no one can catch them anyway as a thread is a separate flow of excecution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I maintain a Python program that provides advice on certain topics. It does this
I have written an application that allows a user to create and run a
I want to make a Chrome extension that does this (automatically logs onto a
I noticed that when you run the app on the simulator, the data is
I've built a crawler that had to run on about 5M pages (by increasing
serializeArray() does not pick up form fields that have been added after page load
I have a linux shell script that when run from command line works perfectly
Is it possible to run a case-insensitive cypher query on neo4j? Try that: http://console.neo4j.org/
I had a quick question about cookie security that I wanted to run by
Suppose I have a Runnable that does a simple file writing operation, and this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.