-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFailFast.java
37 lines (27 loc) · 891 Bytes
/
FailFast.java
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
import java.util.Set;
import java.util.TreeSet;
import java.util.Iterator;
public class FailFast {
public static void main(String args[]) {
try
{
TreeSet<String> ts = new TreeSet<>();
ts.add("C");
ts.add("C++");
ts.add("Java");
Iterator tsIterator = ts.iterator();
ts.add("Php");
while(tsIterator.hasNext())
{
System.out.println(tsIterator.next());
}
}
catch(Exception e)
{
System.out.println(e);
}
}
}
// Output:
// PS C:\Users\Neel Prajapati\OneDrive\Desktop\Java Task> cd "c:\Users\Neel Prajapati\OneDrive\Desktop\Java Task\" ; if ($?) { javac FailFast.java } ; if ($?) { java FailFast }
// java.util.ConcurrentModificationException