+ 1

Please provide the code to print initials of a name in Java

Please provide the code to print the initial of te first name with the last name unchanged. Language: Java/C/C++ Your help will be heartily appreciated.

12th Oct 2017, 3:58 PM
Supriyo Mahato
Supriyo Mahato - avatar
3 Respostas
+ 5
Java: Scanner sc = new Scanner(System.in); System.out.println(sc.next().charAt(0) + " " + sc.next());
12th Oct 2017, 7:10 PM
Rrestoring faith
Rrestoring faith - avatar
+ 3
Looking for output like this, I believe: Input Name Mark Paramonte Output M Paramonte
12th Oct 2017, 4:40 PM
Mark Paramonte
Mark Paramonte - avatar
+ 2
Yes, only the first name should be replaced with the initial character.
12th Oct 2017, 4:43 PM
Supriyo Mahato
Supriyo Mahato - avatar