We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Because you cant do the input of a string after getting an integer.so when you try the input of an integer then you hit the 'Enter' then this enter will move to the variable as a string input. And you will not be able to get the input of the Actual String input.
thats why there is " scan.nextLine(); ". Hope you understand! All the very best and enjoy programming.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java Stdin and Stdout II
You are viewing a single comment's thread. Return to all comments →
Because you cant do the input of a string after getting an integer.so when you try the input of an integer then you hit the 'Enter' then this enter will move to the variable as a string input. And you will not be able to get the input of the Actual String input. thats why there is " scan.nextLine(); ". Hope you understand! All the very best and enjoy programming.