+ 1
When using scanner in java, what is use of nextLine()?
I mean for this program Scanner x=new scanner (system.in) ; System. out. println(x.nextLine ()) ; //why nextLine() is used? What does this mean and what is it's importance. It will be very helpful. Guys I am very beginner here.
4 ответов
+ 5
nextLine() is used when String inputs are taken just like nextInt() is used when integer inputs are taken
+ 2
It is here in the course.
https://www.sololearn.com/learn/Java/2220/
+ 1
Thanks guys.
0
nextLine() is a method of Scanner class. So, using the object of Scanner class u can able to call that function and the main use of that method is to take string input from the user.
So, after compilation it ask you to enter a string and outputs it.