12. To Get Initial Character of Every Word - prabhatrocks07/Core-Java-Programming GitHub Wiki

public class InitialCharacter {

public static void main(String[] args) {
	System.out.println("-- Enter the String :--");
	Scanner sc = new Scanner(System.in);
	String str = sc.nextLine();
	sc.close();
	str = " " + str;
	str = str.toUpperCase();
	char ch;
	int length = str.length();
	
	for (int i = 0; i < length; i++) {
		ch = str.charAt(i);
		if(ch == ' ') {
			System.out.print(str.charAt(i+1) + " ");
		}
	}
}

}