Computer Science, asked by shwetaarorapentagon, 3 months ago

Write a Program to print your first name in one line and your last name in the

second line.​

Answers

Answered by SP85
1

Here I have used java scanner class

import java.util.Scanner;

class Main

{

public static void main(String[] args)

{

Scanner input = new Scanner (System.in);

System.out.print("Input your first name: ");

String fname = input.next();

System.out.print("Input your last name: ");

String lname = input.next();

System.out.println();

System.out.println("Hello \n"+fname+" "+lname);

}

}

Similar questions