0

w a java program to enter name i.e. Raja Ram Mohan Rai and print R R M R

18th Sep 2016, 2:25 PM
Akshansh mishra
Akshansh mishra - avatar
4 Respostas
+ 1
public static void main(String[] args){ Scanner sc=new Scanner(System.in); System.out.println("Type your full name: "); String fullName=sc.nextLine(); System.out.println("Your short name is: "); System.out.println(shorten(fullName)); } private static String shorten(String full){ StringBuilder sb=new StringBuilder(); String[] names=full.split(" "); for(String name:names){ name=name.toUpperCase(); sb.append(name.charAt(0)); sb.append(" "); } return sb.toString(); }
18th Sep 2016, 3:46 PM
Ahmad Samy
Ahmad Samy - avatar
0
no se
23rd Sep 2017, 11:32 PM
Benji
Benji - avatar
0
aaaaaaaahhhhhhhhh
23rd Sep 2017, 11:32 PM
Benji
Benji - avatar
0
Alo
23rd Sep 2017, 11:33 PM
Benji
Benji - avatar