-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQue-48.java
More file actions
54 lines (54 loc) · 1.5 KB
/
Copy pathQue-48.java
File metadata and controls
54 lines (54 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//Write a Program to demonstrate Vector class. Perform insert, delete and access operation.
//By: Parth Panjwani
import java.util.*;
class Que48{
public static void main(String[] args) {
Vector<String> v = new Vector<String>();
v.add("A");
v.add("B");
v.add("C");
v.add("D");
v.add("E");
v.add("F");
v.add("G");
v.add("H");
v.add("I");
v.add("J");
v.add("K");
v.add("L");
v.add("M");
v.add("N");
v.add("O");
v.add("P");
v.add("Q");
v.add("R");
v.add("S");
v.add("T");
v.add("U");
v.add("V");
v.add("W");
v.add("X");
v.add("Y");
v.add("Z");
System.out.println("Elements in Vector are: ");
for (String s : v) {
System.out.println(s);
}
System.out.println("\nElements after deleting element at index 3: ");
v.remove(3);
for (String s : v) {
System.out.println(s);
}
System.out.println("\nElements after deleting element at index 5: ");
v.remove(5);
for (String s : v) {
System.out.println(s);
}
System.out.println("\nElements after deleting element at index 9: ");
v.remove(9);
for (String s : v) {
System.out.println(s);
}
System.out.println("\nElements after deleting element at index 15: ");
}
}