Multiple choice technology web technology

What is the output for the below code ? class A implements Runnable{ public void run(){ System.out.println(Thread.currentThread().getName()); } } public class Test { public static void main(String... args) { A a = new A(); Thread t = new Thread(a); Thread t1 = new Thread(a); t.setName("t"); t1.setName("t1"); t.setPriority(10); t1.setPriority(-3); t.start(); t1.start(); } }

  1. t t1

  2. t1 t

  3. t t

  4. Compilation succeed but Runtime Exception

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Setting thread priority to -3 throws IllegalArgumentException because Thread priority must be between MIN_PRIORITY (1) and MAX_PRIORITY (10). The code compiles successfully but fails at runtime when t1.setPriority(-3) executes. Thread priorities range from 1-10 only; values outside this range cause runtime exceptions.