e9_1.java

来自「java 初学者学习实例」· Java 代码 · 共 34 行

JAVA
34
字号
public class E9_1
{
  static Lefthand left;	static Righthand right;	
  public static void main(String args[])
  {
   left = new Lefthand();
   right = new Righthand();
   left.start();
   right.start();
  }
} 
class Lefthand extends Thread
{
public void run()
  {
    for(int i=0;i<=5;i++)
      { System.out.println("i am a student");
        try{sleep(500);}
        catch(InterruptedException e){}
     }
  }
}
class Righthand extends Thread
 {
public void run ()
  {
       for(int i=0;i<=5;i++)
       {System.out.println("i am oookkk");
       try{sleep(300);}
       catch(InterruptedException e){}
      }
   }
 }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?