I have multiple java classes in my project and in each class I am using Scanner class to take input and then I close it in finally clause.
When I use scanner object in main class under do...while loop and call those classes it works fine for one iteration however it gives an Exception as "NO SUCH ELEMENT EXCEPTION".
I removed the scanner close function in all other classes and it works fine.
Why is that so?