+ 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