Programming Language › Java thread MCQ › Question #2301
Single Choice Not Set

QPredict the output:
class A implements Runnable{
      public void run(){
            try{
                  for(int i=0;i<4;i++){
                        Thread.sleep(100);
                        System.out.println(Thread.currentThread().getName());
                  }
            }catch(InterruptedException e){
            }
      }
}

public class Test{
      public static void main(String argv[]) throws Exception{
            A a = new A();
            Thread t = new Thread(a, "A");
            Thread t1 = new Thread(a, "B");
            t.start();
            t.join();
            t1.start();
      }
}

ID: #2301 Java thread MCQ 1,033 views
Question Info
#2301Q ID
Not SetDifficulty
Java thread MCQTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A A A A A B B B B ✔ ✖
  • B A B A B A B A B ✔ ✖
  • C Output order is not guaranteed ✔ ✖
  • D Compilation succeed but Runtime Exception ✔ ✖
Correct Answer

Explanation

A A A A B B B B
Today: 0 answered · 0 correct
Save progress
Free account

Want to remember what you got wrong?

Create a free account in seconds to track your score, revisit mistakes and continue Programming Language where you left off.

  • Save your progress & streak
  • Topic-wise quizzes & scores
  • Bookmark tricky questions
  • Printable MCQ sets
Practice smarterFree account · save progress
Sign up free

Share This Question

Challenge a friend or share with your study group.