Java: Close a Scanner? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 10

Java: Close a Scanner?

Is it necessary to close the Scanner using close() method after we use it?

4th Aug 2018, 8:30 AM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
3 Answers
+ 4
https://www.sololearn.com/discuss/1439441/?ref=app
5th Aug 2018, 5:45 AM
Yesh Jadav
Yesh Jadav - avatar
+ 3
It is not absolutely necessary to close the scanner but as mentioned above it can cause a resource leak. A dilligent coder would close the scanner to avoid resource related issues. https://www.sololearn.com/discuss/1438010/?ref=app
5th Aug 2018, 4:03 AM
Just Belief
Just Belief - avatar