Hi folks,
I am new to
JAVA and to this forum. I have been trying some online tutorials and came across one that would use Scanner to get user input. Below is the code for the same and the errors that I am receiving
(
import java.util.Scanner;
public class learn_to_add {
Scanner user_input = new Scanner( System.in );
String first_name;
System.out.print("Enter your first name: ");
first_name = user_input.next( );
String family_name;
System.out.print("Enter your family name: ");
family_name = user_input.next( );
String full_name;
full_name = first_name + " " + family_name;
System.out.println("You are " + full_name);
}
}
I have highlighted the error in red. Below are the error messages for it:
Multiple markers at this line
- Syntax error on token ";", { expected after this token
- Syntax error on token ""Enter your first name:"", delete
this token
- Syntax error on token(s), misplaced construct(s)
- Syntax error on token(s), misplaced construct(s)
- Syntax error on token ""Enter your first name: "", delete
this token
I am so lost!! One line, so many errors...but my other question would be: i have the same line of coding for the family name, why doesn't it show as a error too? THANKS FOR YOUR HELP!!! Looking forward to be an active member...