Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package demo2;
- class Runner implements Runnable
- {
- public void run()
- {
- for ( int i = 0; i<10; i++)
- {
- System.out.println("Hello " + i);
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
- }
- public class App {
- public static void main(String[] args) {
- Thread t1 = new Thread(new Runner());
- Thread t2 = new Thread(new Runner());
- t1.start();
- t2.start();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement