Example of next() method
Read moreHow do you ask a name in Java?
Type a first name, and then hit the enter key on your keyboard . After you hit the enter key, java will take whatever was typed and store it in the variable name to the left of the equals sign. For us, this was the variable called first_name.
Read moreHow do you enter a name and age in Java?
println(“Enter your name :”); String st=s. nextLine(); System. out. println(“Enter your age :”); int age=s.
Read more