fork download
  1. import java.util.ArrayList;
  2. import java.util.Arrays;
  3. import java.util.List;
  4.  
  5. public class Main {
  6.  
  7. public static void main(String[] args) {
  8.  
  9. List<Integer> ints = Arrays.asList(1, 2, 3);
  10.  
  11. List<String> strings = new ArrayList(ints); //allowed, causes heap pollution
  12.  
  13. String string = strings.get(0); //ClassCastException
  14. }
  15. }
Runtime error #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout

Standard output is empty