You are not logged in.

#1 2015-06-09 06:47:38

husnain
User RankUser RankUser RankUser RankUser RankUser Rank
Administrator
From: Chichawatni,Pakistan
Registered: 2014-10-03
Posts: 8,129
Website

Public Void:

Question:
This is an example for priority of a thread give the output for the following program ?
class Multi10 extends Thread{
public void run(){
System.out.println("running thread name is:"+Thread.currentThread().getName());
System.out.println("running thread priority is:"+Thread.currentThread().getPriority());

}
public static void main(String args[]){
Multi10 m1=new Multi10();
Multi10 m2=new Multi10();
m1.setPriority(Thread.MIN_PRIORITY);
m2.setPriority(Thread.MAX_PRIORITY);
m1.start();
m2.start();

}
}

Option A):
running thread name is:Thread-0
running thread priority is:10
running thread name is:Thread-1
running thread priority is:1
Option B):
running thread name is:Thread-0
running thread priority is:1
running thread name is:Thread-1
running thread priority is:5
Option C):
running thread name is:Thread-0
running thread priority is:5
running thread name is:Thread-1
running thread priority is:1
Option D):
None

Correct Answer is Option A):
running thread name is:Thread-0
running thread priority is:10
running thread name is:Thread-1
running thread priority is:1


You cannot discover the new oceans unless you have the courage to lose the sight of the shore.

2015-06-09 06:47:38

Advertisement
Ads By Google

Re: Public Void:



Board footer