I mean in a program that takes input more than once, would I need to close the object after each use, or just after the last input? sorry noob here
thanks for reading :)
I mean in a program that takes input more than once, would I need to close the object after each use, or just after the last input? sorry noob here
thanks for reading :)
You should close your scanner when you are done using it. This prevents memory leaks.
But you definitely don´t have to close it after every keyboard input.
Of course closing the object takes computing time but I don´t think you have to worry about this as a starter.