Java Programming Questions and Answers
What will happen if two thread of same priority are called to be processed simultaneously?
What is the priority of the thread in output of this program?
classmultithreaded_programing{
publicstaticvoidmain(String args[]){
Thread t = Thread.currentThread();
System.out.println(t);
}
}
What is the name of the thread in output of this program?
classmultithreaded_programing{
publicstaticvoidmain(String args[]){
Thread t = Thread.currentThread();
System.out.println(t);
}
}
What is the name of the method used to start a thread execution?
In java a thread can be created by ?
C is the correct answer.
What will be the output of the following program code?
public class Test implements Runnable{public static void main(String[] args){
Thread t = new Thread(this);
t.start();
}public void run(){
System.out.println("test");
}
}
A is the correct answer.
Which method in thread class causes the currently executing thread object to temporarily pause and allow other threads to execute?
Answer:C
In how many states Threads can be explained ?
Answer:B
Which method is used to perform interthread communications?