Advertisement
fahimkamal63

Multithreading

Aug 18th, 2019
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.76 KB | None | 0 0
  1. /**
  2.  * Presentation code for Multithreading
  3.  * Date : 01.08.19
  4.  */
  5. package Multithreading;
  6.  
  7. class A extends Thread {
  8.     public void run(){
  9.         for(int i = 20; i < 30; i++){
  10.             System.out.println(i);
  11.         }
  12.     }
  13. }
  14.  
  15. class B extends Thread {
  16.     public void run(){
  17.         for(int i = 40; i < 50; i++){
  18.             System.out.println(i);
  19.         }
  20.     }
  21. }
  22.  
  23. class C extends Thread {
  24.     public void run(){
  25.         for(int i = 60; i < 70; i++){
  26.             System.out.println(i);
  27.         }
  28.     }
  29. }
  30.  
  31. public class TestThreads {
  32.     public static void main(String[] args){
  33.         A ob1 = new A();
  34.         B ob2 = new B();
  35.         C ob3 = new C();
  36.        
  37.         ob1.start();
  38.         ob2.start();
  39.         ob3.start();
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement