Computer Science, asked by ujjwalusri, 1 year ago

Write a program in java to accept the name containing first, middle and surname and print the name after removing middle name...

Sample Input.....Ashish Kumar Nehra

Sample Output..... Ashish Nehra

Answers

Answered by Saloni001
3
hello mate!!☺️
____________
a program in java to accept the name containing first, middle and surname and print the name after removing middle name.......

import .java util.*;
class name;{
public static void main(){
Scanner sc=new Scanner(System.in);
String n,a,m;
System.out.print("enter name with first middle and last name respectively");
n=sc.nextLine();
a=sc.nextLine();
m=sc.nextLine();
System.out.println(+n+" "+m);
}
}

hope it helps u!!!!!

and u find it helpful....

thank you!!❤️❤️

ujjwalusri: Enter name in one line
Saloni001: maine println nhi print diya hai
ujjwalusri: ok
Similar questions