OnJava8-Examples/strings/InfiniteRecursion.java

18 lines
440 B
Java
Raw Normal View History

2015-04-20 15:36:01 -07:00
//: strings/InfiniteRecursion.java
// Accidental recursion.
2015-05-05 11:20:13 -07:00
// {ThrowsException}
2015-04-20 15:36:01 -07:00
import java.util.*;
public class InfiniteRecursion {
2015-05-05 11:20:13 -07:00
@Override
2015-04-20 15:36:01 -07:00
public String toString() {
return " InfiniteRecursion address: " + this + "\n";
}
public static void main(String[] args) {
2015-05-05 11:20:13 -07:00
List<InfiniteRecursion> v = new ArrayList<>();
2015-04-20 15:36:01 -07:00
for(int i = 0; i < 10; i++)
v.add(new InfiniteRecursion());
System.out.println(v);
}
} ///:~