+ 1
What is "no such element exception"
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; name = fn + sn; System.out.println("name"); } }
1 Answer
+ 5
import java.util.Scanner;
public class MyClass {
public static void main(String[] args) {
Scanner sc= new Scanner (System.in);
System.out.print("Input your first name: ");
String fn= sc.next();
System.out.print("Input your last name: ");
String sn= sc.next();
System.out.println();
System.out.println("Hello \n"+fn+" "+sn); } }
do like this you will get your desired output
https://code.sololearn.com/cQ3ywYHsldC2/?ref=app