0

hello

i have a problem with Priority when I set priority of any thread then I get wrong output my code is below

```
class Run implements Runnable{
private String st;
public Run(String s){
st=s;
}
public void run(){
for(int i=1 ; i<=10 ; i++){
System.out.println(st+"="+i);
}
}
}
class PriorityCheck{
public static void main(String ss[]){
Run first=new Run("First");
Run second=new Run("Second");
Thread t1=new Thread(first);
Thread t2=new Thread(second);
t1.setPriority(Thread.MIN_PRIORITY);
t2.setPriority(Thread.MAX_PRIORITY);
t1.start();
t2.start();
}
}
```

and its output is below

```
First=1
Second=1
First=2
Second=2
First=3
Second=3
First=4
Second=4
First=5
Second=5
First=6
Second=6
First=7
Second=7
First=8
Second=8
First=9
Second=9
First=10
Second=10
```

but output should like this

```
Second=1
Second=2
Second=3
Second=4
Second=5
Second=6
Second=7
Second=8
Second=9
Second=10
First=1
First=2
First=3
First=4
First=5
First=6
First=7
First=8
First=9
First=10
```

please help me