Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Test1{
- static class a extends Thread{
- public void run(){
- f();
- }
- }
- static class b extends Thread{
- public void run(){
- g();
- }
- }
- public static synchronized void f(){
- int i =0;
- while(true){
- System.out.println("Hello" + i++);
- }
- }
- public static synchronized void g(){
- int i =0;
- while(true){
- System.out.println("GoodBye"+ i++);
- }
- }
- public static void main(String[] args){
- new a().start();
- new b().start();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement