Pre Exam Test Practice (SSC | Banking | IAS | GATE | State Level | CLAT | Railways | Insurance | Teaching Exams | NDA | Defence | IES |State Exam )

Organizational Research By

Surprising Reserch Topic

java how to use thread join using -'java,concurrency,join,multithreading'

java how to use thread join  using -'java,concurrency,join,multithreading'

I'm new to threads. How can I get t.join to work, whereby the thread calling it waits until t is done executing?

This code would just freeze the program, because the thread is waiting for itself to die, right?

public static void main(String[] args) throws InterruptedException {
    Thread t0 = new Thready();


public void run() {
    for (String s : info) {
        try {
        } catch (InterruptedException e) {
        System.out.printf("%s %s%n", getName(), s);

What would I do if I wanted to have two threads, one of which prints out half the info array, then waits for the other to finish before doing the rest?

asked Sep 7, 2015 by rajesh
0 votes

Related Hot Questions

Government Jobs Opening