

Hi Friend,
import java.util.*;
public class InitialName {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Input Name: ");
String str = input.nextLine();
String st[] = str.split(" ");
char ch[] = new char[st.length - 1];
for (int i = 0; i < st.length - 1; i++) {
ch[i] = st[i].charAt(0);
}
int len = st.length;
for (int i = 0; i < ch.length; i++) {
System.out.print(ch[i] + ".");
}
System.out.print(st[len - 1]);
}
}
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.