IntVectorExample

IntVectorExample - { num = (Integer) intList.elementAt(i);

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
r import java.util.Vector; i public class IntVectorExample { public static void main(String[] arg) { Vector<Integer> intList = new Vector<Integer>(20); Integer num; System.out.println("Empty: " + intList.isEmpty()); System.out.println("Size: " + intList.size()); System.out.println("Capacity: " + intList.capacity()); for (int i = 0; i < 10; i++) { num = i + 5; intList.insertElementAt(num, i); } intList.addElement(75); intList.addElement(new Integer(78)); for (int i = 0; i < 11; i++)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { num = (Integer) intList.elementAt(i); System.out.print(num + &quot; &quot;); } System.out.println(); System.out.println(&quot;Empty: &quot; + intList.isEmpty()); num = 75; System.out.println(intList.contains(num)); intList.set(4, num); System.out.println(intList.toString()); System.out.println(&quot;Length: &quot; + intList.size()); System.out.println(&quot;Capacity: &quot; + intList.capacity()); intList.trimToSize(); System.out.println(&quot;Length: &quot; + intList.size()); } }...
View Full Document

Ask a homework question - tutors are online