Vectors Programming Source Code
package testFileHandling;import java.util.*;
import javax.swing.text.html.HTMLDocument.Iterator;
public class DebugTheCode {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
//create an empty array
Vector<Integer> list= new Vector<Integer>(3,2);//vector with 3 elements and increment of 2
System.out.println("Vector Capacity"+list.capacity());
list.add(new Integer(1));
list.add(new Integer(2));
list.add(new Integer(3));
list.addElement(new Integer(4));
for(int x=0;x<4;x++)
{
System.out.println(list.get(x));
}
}
}
No comments:
Post a Comment