关于“静态导入”的问题

polaris_chow 2007-10-08 10:03:31
比较下面两段代码:
import static java.lang.System.out;
......
out.println(“ ”);
.......

import static javax.swing.WindowConstants.*;
//Warning: The import javax.swing.WindowConstants is never used
......
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
......

为什么第二段代码会出现警告?
...全文
83 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
endswel 2007-10-09
  • 打赏
  • 举报
回复
看 API 从接口 javax.swing.WindowConstants 继承的字段
polaris_chow 2007-10-09
  • 打赏
  • 举报
回复
我也是这个意思
this.setDefaultCloseOperation(EXIT_ON_CLOSE); 不是用到了 javax.swing.WindowConstants吗?
为什么还会有警告错误?
Lisliefor 2007-10-08
  • 打赏
  • 举报
回复
//Warning: The import javax.swing.WindowConstants is never used
警告:包含的javax.swingWindowConstants 没有被使用到。


删除该行即可。

62,623

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧