public class runnable1 implements Runnable {
@Override
public void run() {
for (int x = 1; x <= 3; x++) {
System.out.println(x + " Thread name, priority and group are "
+ Thread.currentThread()); }
}
public static void main(String[] args) {
runnable1 run1 = new runnable1();
Thread t1 = new Thread(run1);
t1.start();
}
}
Output
1 Thread name, priority and group are Thread[Thread-0,5,main]
2 Thread name, priority and group are Thread[Thread-0,5,main]
3 Thread name, priority and group are Thread[Thread-0,5,main]
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.