"Resource Leak: '<var_name>' is never closed" in Java. What does that mean? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

"Resource Leak: '<var_name>' is never closed" in Java. What does that mean?

So i'm just starting out in Java and i've been having these "warning" messages; Scanner scal= new Sacnner(System.in); "Resource Leak: 'scal' is never closed" I still can compile but i can't seem to understand what's happening.

4th Apr 2018, 2:16 PM
Twenty-three
2 Answers
+ 3
scal.close() at the end of using it.
4th Apr 2018, 2:23 PM
Bartosz Pieszko
Bartosz Pieszko - avatar
0
Thanks a lot!!
4th Apr 2018, 2:37 PM
Twenty-three