+ 1

Java help input output

I need some help with input and output and why my code is not working. can somebody kind of explain to me why my code is throwing me an error. I want to store user input in the variable name I know I called the Scanner right at least I believe but for some reason after I added the name=input.next line(); it says no output or that the period is not known. https://code.sololearn.com/cNfshpppXxJY/?ref=app

30th Jul 2017, 3:57 PM
StealthyTaco
StealthyTaco - avatar
2 Answers
+ 4
In case you didn't know, Java is case sensitive. That said, everything about your program is correct except for 'nextline()'. Just replace that with 'nextLine()' and you'll be good to go â˜ș
30th Jul 2017, 4:01 PM
Garikai
Garikai - avatar
0
import java.util.Scanner; class Myclass{ public static void main(String[] args) { Scanner input = new Scanner(System.in); String message,name; message = "Hello, What is your name?\n\n"; name=input.nextLine(); System.out.println(message + "Hello " + name + ", Nice to meet you!"); } }
30th Jul 2017, 4:28 PM
D_Stark
D_Stark - avatar