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); //compiler error
  12.  
  13. String string = strings.get(0);
  14. }
  15. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:11: error: incompatible types
        List<String> strings = new ArrayList<>(ints); //compiler error
                               ^
  required: List<String>
  found:    ArrayList<Integer>
1 error
stdout

Standard output is empty