Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main {
- public static void main(String[] args) {
- Thread[] threads = new Thread[10];
- for ( int i = 0; i<10; i++)
- {
- threads[i] = new Thread(new Fib(),"Thread" + i);
- }
- for (Thread thread : threads)
- {
- thread.start();
- try
- {
- thread.join(); // wait for the threads to terminate
- }
- catch (InterruptedException e)
- {
- e.printStackTrace();
- }
- }
- //System.out.println("Thread "+ fib.getName() + " started.");
- System.out.println();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement