Q.
Create two threads and assign names ‘Scooby’ and ‘Shaggy’ to the two
threads. Display both thread names.
CODE:
package com.packagep1;
public class Main {
public static void main(String[] args) {
Thread t1 = new Thread("Scooby") {
public void run() {
[Link]("I'm " + [Link]().getName());
}
};
Thread t2 = new Thread("Shaggy") {
public void run() {
[Link]("I'm " + [Link]().getName());
}
};
[Link]();
[Link]();
SS: