Created
December 16, 2011 02:26
-
-
Save takuma7/1484143 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Mondai16_3{ | |
public static void main(String[] args){ | |
MyThreadA a = new MyThreadA(); | |
MyThreadB b = new MyThreadB(); | |
a.start(); | |
b.start(); | |
} | |
} | |
class MyThreadA extends Thread{ | |
public void run(){ | |
for(int i=0; i<10; i++){ | |
try{ | |
Thread.sleep(3000); | |
}catch(InterruptedException e){} | |
System.out.println("***"); | |
} | |
} | |
} | |
class MyThreadB extends Thread{ | |
public void run(){ | |
for(int i=0; i<10; i++){ | |
try{ | |
Thread.sleep(5000); | |
}catch(InterruptedException e){} | |
System.out.println("===="); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment