-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest2.java
More file actions
76 lines (67 loc) · 1.35 KB
/
Test2.java
File metadata and controls
76 lines (67 loc) · 1.35 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
public class Test2 {
public static void main(String[]args){
try {
SuperArray bopp = new SuperArray(-10);
}
catch (IllegalArgumentException e) {
e.printStackTrace();
}
SuperArray words = new SuperArray(5);
words.add("Delta");
words.add("Epsilon");
words.add("Zeta");
words.add("Eta");
words.add("Theta");
words.add("Iota");
words.add("Kappa");
words.add("Lambda");
try {
words.get(10);
}
catch (IndexOutOfBoundsException e) {
e.printStackTrace();
}
try {
words.get(-2);
}
catch (IndexOutOfBoundsException e) {
e.printStackTrace();
}
try {
words.set(-2, "Hello");
}
catch (IndexOutOfBoundsException e) {
e.printStackTrace();
}
try {
words.set(10, "Hello");
}
catch (IndexOutOfBoundsException e) {
e.printStackTrace();
}
try {
words.add(-5, "Hello");
}
catch (IndexOutOfBoundsException e) {
e.printStackTrace();
}
try {
words.add(9, "Hello");
}
catch (IndexOutOfBoundsException e) {
e.printStackTrace();
}
try {
words.remove(-1);
}
catch (IndexOutOfBoundsException e) {
e.printStackTrace();
}
try {
words.remove(30);
}
catch (IndexOutOfBoundsException e) {
e.printStackTrace();
}
}
}