For some, my eclipse IDE complains whenever I do something like this:
Map<Type,Type> map = new HashMap<Type,Type>();
it underlines Map and prefers I do something like this:
HashMap<Type,Type> map = new HashMap<Type,Type>();
Same goes for all the other interfaces. What could be the problem with my eclipse?
您必须import java.util.Map
Nothing's wrong with Eclipse (of course) assuming that you're using the Kepler release, but instead it's your settings that are off. You need to set your Java Compiler compliance setting to 1.7. It's currently set at less than that.
you must set your JAVA compiler to 1.7. for reference see my below picutre.
Read exact error message and suggestions.
Also check your current state of HashMap
. Changing Map
to HashMap
is really an option, so Eclipse is correct.
The reason your Eclipse doesn't suggest to import Map
is ambiguous.
Type all line and imports by hand and save all files. Then check what Eclipse will say.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.