Thread methods

 package com.company;

class papa extends Thread{
int i=9;

public void run(){
while (i<=10987){
System.out.println("Hello mai papa hu");
i++;
}
}
}
class mom extends Thread{
int j=9;
public void run(){
while(j<10000){
System.out.println("Mai mummy hu");
j++;
// try {
// Thread.sleep(6555);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
}
}
}
public class CWH_75_Thread_methods {
public static void main(String[] args) {
papa p=new papa();
mom m= new mom();
p.start();
// try{
// p.join();
// }
// catch(Exception e){
// System.out.println(e);
// }
m.start();
}
}

Comments