How do I create a Vector of ints?
• A. ints are primitive types and hence can’t be stored by the Vector class which stores objects. You’ll need to wrap the ints. Try this: • int i =7; Vector holdsInts = new Vector(5,1); holdsInts.addElement(new Integer(i)); int j = ((Integer)holdsInts.elementAt(0)).intValue(); 5.17 I have several worker threads. I want my main thread to wait for any of them to complete, and take action as soon as any of them completes. I don’t know which will complete soonest, so I can’t just call Thread.join on that one. How do I do it? • A. You need to use the wait/notify mechanism to allow any of the worker threads to wake up your main thread when the worker has completed.