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 7614809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:29:50+00:00 2026-05-31T02:29:50+00:00

i create three threads in my main program. i have for loop in each

  • 0

i create three threads in my main program. i have for loop in each thread. After executing the statements in the run() method , each thread automatically gets destroyed or killed by itself. correct? Is my understanding correct ?

IS there any Java standard reference where it mentions that there is no need to explicitly kill a thread and it does by itself. i have been trying to read and browse many articles. but still not getting 100% confidence.

I would highly appreciate if any expert over here could reply and help me out. Thanks in advance!!!

public class Demo {
    TestA A = new TestA("TestA",threadAList);
    TestA B = new TestB("TestB",threadBList);
    TestA C = new TestC("TestC",threadCList);
}

class TestA implements Runnable {
    Thread t;

    public TestA(String name,List threadAList) {
        System.out.println(name);
        this.threadAList = threadAList;
        t = new Thread(this);
        t.start();
    }

    public void run() {
        try {
            System.out.println("TestA Thread started");
        }
        catch(Exception e) {
            e.printStackTrace(log);
            doing some action to move the faild file to a failure folder    
        }
        finally {
            log.close();
        }
    }
}
  • 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-05-31T02:29:51+00:00Added an answer on May 31, 2026 at 2:29 am

    Yes, the thread is automatically destroyed and made available for garbage collection once its Runnable‘s run method has returned.

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

Sidebar

Related Questions

I have a simple program which starts n threads and create some load on
I have three classes that all have a static function called 'create'. I would
I have a program that needs to run a function M times per iteration,
I have a Java program that uses reflection to find and invoke the main(String[]
So I have an application which uses threads. Now when the program first starts
I have a program who run as zombie process. I want to debug it.
I have a main program, in which GUI is based on swing and depending
c program compiler gcc I have 3 files. main.c stop_watch.h and stop_watch.c This program
I wish to know is there any way that I can create the threads
In this example I create three buttons 'one' 'two' 'three'. When clicked I want

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.