Multiple choice technology programming languages

What will happen when you attempt to compile and run the following code? public class Bground extends Thread{ public static void main(String argv[]){ Bground b = new Bground(); b.run(); } public void start(){ for (int i = 0; i <10; i++){ System.out.println("Value of i = " + i); } } }

  1. A compile time error indicating that no run method is defined for the Thread class.

  2. A run time error indicating that no run method is defined for the Thread class.

  3. Clean compile and at run time the values 0 to 9 are printed out.

  4. Clean compile but no output at runtime.

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

Bground overrides start() instead of run(). When b.run() is called directly in main(), it executes Thread's default run() method which does nothing. There's no compilation error (the class is valid) and no runtime error (empty run() is legal). The overridden start() method is never called because run() is invoked directly.