Passing Scanner Object as a Parameter in Java
There are different ways to input data from the user using Scanner Class. Every time when we need input from the user a Scanner object is declared. Sometimes there is a possibility of getting a restriction on the number of objects that can be created. So we may not get a chance to create another object in order to input data from the user. In such a situation, we can pass a Scanner object that is already created as a parameter to the method where you need to input the data. The below code helps you to get a clear idea about it!
What is your name? VISHNUPPRIYAN Your name is VISHNUPPRIYAN!
My Personal Notes arrow_drop_up
Please Login to comment...