+ 1
Why is my code not running
import java.util.Scanner; class MyClass { public static void main(String[ ] args) { Scanner sc = new Scanner(System.in); String fn = sc.next(); String sn = sc.next(); String name = fn + sn; System.out.println("name"); } }
2 Answers
+ 4
Remove the " at the print statement to print the name variable:
System.out.println(name);
+ 1
If you do System.out.println("name") you will just print the word name not the String variable name