Multiple choice technology programming languages

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

Thread priorities in Java must be between 1 (MIN_PRIORITY) and 10 (MAX_PRIORITY). The call t1.setPriority(-3) throws IllegalArgumentException at runtime because -3 is outside the valid range. Compilation succeeds since it's syntactically valid.