text: Program to find the initials of a name . | Java program to print initials of a name ; split the string using ' space ' and print the first character of every word ; Driver code
code: class initials { static void printInitials ( String name ) { if ( name . length ( ) == 0 ) return ; String words [ ] = name . split ( " ▁ " ) ; for ( String word : words ) { System . out . print ( Character . toUpperCase ( word . charAt ( 0 ) ) + " ▁ " ) ; } } public static void main ( String args [ ] ) { String name = " prabhat ▁ kumar ▁ singh " ; printInitials ( name ) ; } }