Advertisement
Josif_tepe

Untitled

Mar 24th, 2022
810
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. public class Main {
  2.     public static void main(String[] args) {
  3.  
  4.     MyThread thread = new MyThread();
  5.     thread.start();
  6.     Thread t1 = new Thread(new MyNewThread());
  7.     t1.start();
  8.         System.out.println("End of program");
  9.     }
  10. }
  11. class MyThread extends Thread {
  12.     @Override
  13.     public void run() {
  14.         System.out.println("Thread is running");
  15.     }
  16. }
  17. class MyNewThread implements Runnable {
  18.     @Override
  19.     public void run() {
  20.         System.out.println("New Thread is running");
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement