//: c09:FailFast.java // From 'Thinking in Java, 2nd ed.' by Bruce Eckel // www.BruceEckel.com. See copyright notice in CopyRight.txt. // Demonstrates the "fail fast" behavior. import java.util.*; public class FailFast { public static void main(String[] args) { Collection c = new ArrayList(); Iterator it = c.iterator(); c.add("An object"); // Causes an exception: String s = (String)it.next(); } } ///:~