0% found this document useful (0 votes)
35 views

Vectors in Java

Uploaded by

athravasade
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

Vectors in Java

Uploaded by

athravasade
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Experiment 7B

Aim – Program on String Buffer and Vectors

Program -

import java.util.*;
class jvector
{
public static void main(String args[])
{
Vector<String> vec = new Vector<String>();

vec.add("Apple");
vec.add("Mango");
vec.add("Banana");
vec.addElement("Grapes");
vec.addElement("Papaya");
vec.addElement("Kiwi");
System.out.println("Vector is "+vec);

System.out.println("Size is "+vec.size());

String r = vec.remove(2);
System.out.println("remove ele "+r);
System.out.println("Vector is "+vec);

Boolean rem = vec.removeElement("Kiwi");


System.out.println("Element \t"+rem);
System.out.println("Vector is "+vec);

vec.insertElementAt("Cherry",4);
System.out.println("Vector is "+vec);

}
Experiment 7B

Output -

You might also like