Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How do I create a Vector of ints?

create ints vector
0
0 Posted

How do I create a Vector of ints?

0
0

• 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.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.