Examveda
Examveda

What will be the output?
class One extends Thread{
	public void run(){
		for(int i=0; i<2; i++){
			System.out.print(i);
		}
	}
}

public class Test{
	public static void main(String args[]){
		Test t = new Test();
		t.call(new One());
	}
	
	public void call(One o){
		o.start();
	}
}

A. 0 0

B. Compilation Error

C. 0 1

D. None of these

Answer: Option C


This Question Belongs to Java Program >> Threads

Join The Discussion

Related Questions on Threads

What is a thread in Java?

A. A lightweight process that runs independently within a program

B. A data structure to store variables

C. A type of loop

D. A synchronization mechanism