JAVA
java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class Main {
public static void main(String[ ] args) {
Name name = new Name();
//set priority
name.setPriority(1);
Welcome welcome = new Welcome();
//set priority
welcome.setPriority(10);
name.start();
welcome.start();
}
}
//extend the Thread class
class Welcome extends Thread{
public void run() {
System.out.println("Welcome!");
}
}
//extend the Thread class
class Name extends Thread{
public void run() {
System.out.println("Please enter your name");
}
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run