這樣寫(xiě),編譯器報(bào)錯(cuò):
jshell> List<?> unknows = new ArrayList<?>()
| Error:
| unexpected type
| required: class or interface without bounds
| found: ?
| List<?> unknows = new ArrayList<?>();
| ^----------^
可以這樣寫(xiě):
jshell> List<?> unknows = new ArrayList<String>()
unknows ==> []