快捷导航

set中的getkey方法我怎么用不了???

public void entry(){        Set  entry=students.entrySet();  for (Entry entry2 : entry) {                System.out.println("取的键:"+entry.getkey());}}报错:The method getkey() is undefined for the type Set之前的都没有这个情况啊?

免责声明:本内容仅代表回答者见解不代表本站观点,请谨慎对待。

版权声明:作者保留权利,不代表本站立场。

回复

使用道具 举报

参与会员2

是从entry取值赋给变量entry2,在用entry2获取key,value。
回复

使用道具 举报

entry2.getKey();
回复

使用道具 举报

可能感兴趣的问答

发新帖
  • 微信访问
  • 手机APP