instead of sc.nextString()

So I was programming when I realized that after taking an integer input from user sc.nextString() does not work but does, why?

sc.nextString() takes input as string and not as integer while next() takes the input in integer and string both. So basically you can either use or sc.nextInt().

1 Like