eclipse编写java代码出现问题:Map.Enttry cannot be resolved to a type
怎么解决//entry遍历Setset2=map.entrySet();for(Objectobj:set2){Map.Entryentry=(Map.Entry)obj...
怎么解决
//entry遍历
Set set2=map.entrySet();
for (Object obj:set2) {
Map.Entry entry=(Map.Entry)obj;
System.out.println(entry.getKey()+entry.getValue());
} 展开
//entry遍历
Set set2=map.entrySet();
for (Object obj:set2) {
Map.Entry entry=(Map.Entry)obj;
System.out.println(entry.getKey()+entry.getValue());
} 展开
展开全部
public class MapTest {
public static void main(String args[])
{
Map<String, String> map = new HashMap<String, String>();
map.put("1", "test");
Set<Entry<String, String>> entrySet = map.entrySet();
for (Entry entry: entrySet)
{
System.out.println(entry.getKey());
System.out.println(entry.getValue());
}
}
}
更多追问追答
追答
他告诉你没有Map.Entry这个类型啊
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询