
write java program to use vector in ArrayList with add, remove,sort

import java.util.Vector;
public class RemoveVectorElement {
public static void main(String[] args) {
Vector<String> vc=new Vector<String>();
//<E> it is return type of Vector
// add vector elements
vc.add("Vector Element NOOR");
vc.add("Vector Element MUAYAD");
vc.add("Vector Element JAVA");
vc.add("Vector Element ARRAYLIST");
vc.add("Vector Element 201110166");
// remove Vector element by index number
vc.remove(3);
// remove Vector element by Object value
vc.remove("Vector Element 5");
// get elements of Vector
for(int i=0;i<vc.size();i++)
{
System.out.println("Vector Element "+i+" :"+vc.get(i));
} } }
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.