You are viewing a single comment's thread. Return to all comments →
Can you explain this logic?
My doubt is where did you get input?
Read the println line you can see that in.nextline() this is were input is taken.
but how it is suppose to print End of line?
hasNext function makes this possible.Till there is any returns true if this scanner has another token in its input.
Instead of storing the input in a seperate string and printing the string...
String input = scanner.nextLine();
I instead just print out the input
Not sure if that was your question. If you are confused as to how it knows when to stop looking for input, the statement:
Will continue looping over and over again until scanner.hasNext() returns false, meaning there is nothing left to read from the Scanner.