以下のコメント文を元にコードを打ち込んでください
// 文字列 "Elephant enjoys eating eggs." を用意する
// メソッド countE を使って 'e' の個数をカウントする(大文字、小文字を区別しない)
// 結果を 「e の数は: 0」と出力する
// クラス名は ECounter とする
// for 文と if 文を使ってカウントする
public class ECounter{
public static void main(String[] args){
String text = "Elephant enjoys eating eggs.";
int result = countE(text);
System.out.println("e の数は: " + result);
}
public static int countE(String str){
int count = 0;
for(int i = 0; i < str.length(); i++){
char c = Character.toLowerCase(str.charAt(i));
if(c == 'e'){
count++;
}
}
return count;
}
}