
WAP to accept a string from the user, using buffered reader and then find the frequency of character 'e' occurring in it

Here is a java example that reads a string from the command prompt and find the frequency of the character e in the input string.
import java.io.*;
class FindFrequencyOFCharacter
{
public static void main(String[] args)
{
try{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter String: ");
String st=br.readLine();
int count=0;
char ch[]=st.toCharArray();
for(int i=0;i<ch.length;i++){
if(ch[i]=='e'){
count++;
}
}
System.out.println("Frequency of character e is: "+count);
}
catch(Exception e){}
}
}
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.