Computer Science, asked by sayanidassneha, 8 months ago

java program using string name to find the initials of each word ​

Answers

Answered by nipundeeptbgp
0

Answer:

This can be done using Java's library class. (StringTokenizer)

Explanation:

import java.util.*; //Extracting two classes (namely, Scanner and StringTokenizer)

public class Test{

private static Scanner sc=new Scanner(System.in);

public static void main(String [ ] args){

System.out.println("Input a statement: ");

StringTokenizer st=new StringTokenizer (sc.nextLine());

while (st.hasMoreTokens()){

String token=st.nextToken();

System.out.println(token.charAt(0));

}

}

}

Similar questions