问题
List<Object> al = Arrays.asList("ABC", "XYZ");
This code works fine in Java11 but when I try this in Java12, it gives an error.
Any hint of what I am missing?
Thanks for the help.
minimal code as asked:
import java.util.Arrays;
import java.util.List;
public class TestFile {
public static void main(String str[]){
List<Object> al = Arrays.asList("ABC", "XYZ");
}
Erro log:
Error:(58, 42) java: incompatible types:java.util.List<java.lang.String> cannot be converted to java.util.List<java.lang.Object>
Java version 12,System windows 10 and IDE intelij
来源:https://stackoverflow.com/questions/60240353/not-able-to-create-list-of-string-object-in-java12