public Class Test implements Runnable{
public void run(Thread t)
{
System.out.println(“Running...”);
}
public static void main(String [] args)
{
new thread(new Test()).start();
}
}

What is the result?

Options
- Compile error.
- Exception is thrown.
- Running… will be printed
- Program exists without printing anything.


CORRECT ANSWER : Compile error.

Discussion Board
another fcode fault

new thread() will also fail to compile.
Needs to be new Thread

Filip 03-8-2017 08:34 AM

solution

public void run(Thread t)
will give compile time error it should implement
public void run()

Manish Malaviya 11-20-2014 06:21 AM

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement