Java Program – to count letters in a string.

1. We will see the example where the String is defined in the program as shown below:

Output:


2. We will see the example where we will get the String from the user inputs in the program as shown below:

Output: