Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class odd extends Thread
- {
- public void run()
- {
- try
- {
- for(int i =1; i<=20;i+=2)
- {
- System.out.println(i);
- Thread.sleep(200);
- }
- }
- catch (InterruptedException e)
- {
- assert false;
- }
- }
- }
- class even extends Thread
- {
- public void run()
- {
- try
- {
- for(int i =2; i<=20;i+=2)
- {
- System.out.println(i);
- Thread.sleep(200);
- }
- }
- catch (InterruptedException e)
- {
- assert false;
- }
- }
- }
- class multi
- {
- public static void main(String[] args)
- {
- odd o= new odd();
- even e= new even();
- o.start();
- e.start();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement