packagecom.yuecheng.hspedu.Runnable00;publicclassRunneable05{publicstaticvoidmain(String[] args){
a a =newa();
b b =newb();Thread thread1 =newThread(a);Thread thread2 =newThread(b);
thread1.start();
thread2.start();}}class a implementsRunnable{int s =1;@Overridepublicvoidrun(){while(s<=10){System.out.println("HelloWorld!"+s++);try{Thread.sleep(1000);}catch(InterruptedException e){
e.printStackTrace();}}}}class b implementsRunnable{int s =1;@Overridepublicvoidrun(){while(s<=5){System.out.println("hi"+s++);try{Thread.sleep(1000);}catch(InterruptedException e){
e.printStackTrace();}}}}