Computer Science, asked by priyamchatterjpdxuo4, 11 months ago

Write a Java program to accept a name as first name with surname insert a middle name as Kumar and display the full name

Answers

Answered by amikkr
0

Program:

import java.util.Scanner;

public class Sample

{

   public static void main(String args[])  throws Exception

   {

       String fname,lname;

       Scanner SC=new Scanner(System.in);

       System.out.print("Enter  First name: ");

       fname= SC.nextLine();

       System.out.print("Enter Last name: ");

       lname=SC.next();

       System.out.println("Full name is: " + fname + " kumar " + lname);

   }

}

OUTPUT:

Enter  First name: Lalit                                                                                                    

Enter Last name: Modi                                                                                                        

Full name is: Lalit kumar Modi

Similar questions