OnJava8-Examples/references/ImmutableInteger.java
2015-05-06 15:14:33 -07:00

13 lines
344 B
Java

//: references/ImmutableInteger.java
// The Integer class cannot be changed.
import java.util.*;
public class ImmutableInteger {
public static void main(String[] args) {
List<Integer> 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?
}
} ///:~