List list = new ArrayList(); 报错:ArrayList cannot be resolved to a type

Reason for error: java.util.List and java.util.ArrayList packages were not imported.
Such as: ` Insert picture description here
Error: Multiple markers at this line
-ArrayList cannot be resolved to
a type
-List cannot be resolved to a
type

` Solution : Import the java.util.List and java.util.ArrayList packages. Be careful not to put the import package statement in front of package Myfirst_package, otherwise an error will be reported: Syntax error on token “package”, import expected. Such as:
wrong import,
Insert picture description here
correct import method :Insert picture description here

Guess you like

Origin blog.csdn.net/qq_43516928/article/details/114685796