📄 example19_1.java
字号:
public class Example19_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 Lefthand");
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 Righthand");
try{sleep(300);}
catch(InterruptedException e) { }
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -