I have used the line sc.nextLine() after taking integer input in order to take String input.
Also how to input strings in an array so as each input is separated by spaces.
Means that I have to input elements of type string in an array but each input case should be separated by space.
I am getting the right answer if I use ENTER instead of SPACE.
Run error : string input after integer
Use sc.next() instead of nextLine() … next() takes space seperated input while nextLine() considers space as a part of string.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.