OnJava8-Examples/references/ImmutableInteger.java

13 lines
333 B
Java
Raw Normal View History

2015-05-05 11:20:13 -07:00
//: references/ImmutableInteger.java
// The Integer class cannot be changed.
import java.util.*;
public class ImmutableInteger {
public static void main(String[] args) {
List v = new ArrayList();
for(int i = 0; i < 10; i++)
v.add(new Integer(i));
// But how do you change the int inside the Integer?
}
} ///:~