Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyClass {
- public static void main(String[] args) throws InterruptedException {
- Thread thread1 = new Thread() {
- @Override
- public void run() {
- System.out.println("Task1");
- }
- };
- Thread thread2 = new Thread() {
- @Override
- public void run() {
- System.out.println("Task2");
- }
- };
- thread1.start();
- thread2.start();
- thread1.join();
- thread2.join();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement