Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class year extends Thread
- {
- public void run()
- {
- try
- {
- String s1[] = {"January","February","March","April","May","June","July","August","September","October","November","December"};
- int i;
- for(i=0;i<12;i++)
- {
- System.out.println(s1[i]);
- Thread.sleep(2);
- }
- }
- catch(InterruptedException ie)
- {
- System.out.println(ie);
- }
- }
- }
- class week extends Thread
- {
- public void run()
- {
- try
- {
- String s2[]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
- int i;
- for(i=0;i<7;i++)
- {
- System.out.println(s2[i]);
- Thread.sleep(2);
- }
- }
- catch(InterruptedException ie)
- {
- System.out.println(ie);
- }
- }
- }
- class my
- {
- public static void main(String args[]) throws InterruptedException
- {
- year y = new year();
- week w = new week();
- y.start();
- w.start();
- y.join();
- w.join();
- for(int i=1;i<=10;i++)
- {
- System.out.println("Inside main");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement