71. Which of the following will ensure the thread will be in running state?
72. Which of these method wakes up all the threads?
73. Which of the following is a correct constructor for thread?
74. What will be the output of the following Java code?
class newthread implements Runnable
{
Thread t;
newthread()
{
t = new Thread(this,"New Thread");
t.start();
}
public void run()
{
t.setPriority(Thread.MAX_PRIORITY);
System.out.println(t);
}
}
class multithreaded_programing
{
public static void main(String args[])
{
new newthread();
}
}
class newthread implements Runnable
{
Thread t;
newthread()
{
t = new Thread(this,"New Thread");
t.start();
}
public void run()
{
t.setPriority(Thread.MAX_PRIORITY);
System.out.println(t);
}
}
class multithreaded_programing
{
public static void main(String args[])
{
new newthread();
}
}
75. Which of this method is used to find out that a thread is still running or not?
76. Which of these statement is incorrect?
77. Which of these method is used to begin the execution of a thread?
78. What will be the output of the following Java program?
class newthread extends Thread
{
Thread t;
newthread()
{
t1 = new Thread(this,"Thread_1");
t2 = new Thread(this,"Thread_2");
t1.start();
t2.start();
}
public void run()
{
t2.setPriority(Thread.MAX_PRIORITY);
System.out.print(t1.equals(t2));
}
}
class multithreaded_programing
{
public static void main(String args[])
{
new newthread();
}
}
class newthread extends Thread
{
Thread t;
newthread()
{
t1 = new Thread(this,"Thread_1");
t2 = new Thread(this,"Thread_2");
t1.start();
t2.start();
}
public void run()
{
t2.setPriority(Thread.MAX_PRIORITY);
System.out.print(t1.equals(t2));
}
}
class multithreaded_programing
{
public static void main(String args[])
{
new newthread();
}
}
79. What requires less resources?
80. What will be the output of the following Java code?
class newthread extends Thread
{
newthread()
{
super("My Thread");
start();
}
public void run()
{
System.out.println(this);
}
}
class multithreaded_programing
{
public static void main(String args[])
{
new newthread();
}
}
class newthread extends Thread
{
newthread()
{
super("My Thread");
start();
}
public void run()
{
System.out.println(this);
}
}
class multithreaded_programing
{
public static void main(String args[])
{
new newthread();
}
}
Read More Section(Threads)
Each Section contains maximum 100 MCQs question on Threads. To get more questions visit other sections.