Resource leak: 'sc' is never closed 资源泄漏:'sc'永远不会关闭

简介: 我们使用Scanne类时总是出现警告的解决方法: Scanner sc = new Scanner(System.in); 出现问题如下图所示: 解决问题如下图所示: 我的GitHub地址:https://github.

我们使用Scanne类时总是出现警告的解决方法:

Scanner sc = new Scanner(System.in);

出现问题如下图所示:

解决问题如下图所示:

我的GitHub地址: https://github.com/heizemingjun
我的博客园地址: http://www.cnblogs.com/chenmingjun
我的蚂蚁笔记博客地址: http://blog.leanote.com/chenmingjun
Copyright ©2018 黑泽明军
【转载文章务必保留出处和署名,谢谢!】
目录
打赏
0
0
0
0
24
分享
相关文章
System.InvalidOperationException:“线程间操作无效: 从不是创建控件“xxx”线程它。”
System.InvalidOperationException:“线程间操作无效: 从不是创建控件“xxx”线程它。”
566 0
使用try-catch-finally关闭资源更优雅的关闭try-with-resource
使用try-catch-finally关闭资源更优雅的关闭try-with-resource
133 1
jps查看进程出现「xxxx -- process information unavailable」
jps查看进程出现「xxxx -- process information unavailable」
1621 0
jps查看进程出现「xxxx -- process information unavailable」
[win32切换x64] Opencv Error Insufficient memory -- 解决措施
[win32切换x64] Opencv Error Insufficient memory -- 解决措施
130 0
“Resource leak: ‘sc‘ is never closed”的解决及解释
“Resource leak: ‘sc‘ is never closed”的解决及解释
501 0
运行项目错误:资源繁忙或者锁定Error: EBUSY:resource busy or locked.lstat
运行项目错误:资源繁忙或者锁定Error: EBUSY:resource busy or locked.lstat
559 0
奥比中光ROS启动节点运行异常退出:[camera/driver-2] process has finished cleanly
奥比中光ROS启动节点运行异常退出:[camera/driver-2] process has finished cleanly
535 0
奥比中光ROS启动节点运行异常退出:[camera/driver-2] process has finished cleanly
oom_kill_process造成数据库挂起并出现found dead shared server
这篇博客是上一篇博客Oracle shutdown immediate遭遇ORA-24324 ORA-24323 ORA-01089的延伸(数据库挂起hang时,才去重启的),其实这是我们海外一工厂的遇到的案例,把内容拆开是因为这个case分开讲述显得主题明确一些。
1321 0