We would like to know how to search a specific letter.
//from w w w . j a va 2 s . co m public class Main { public static void main(String[] args) { int y = 0; char letter = 'e'; String food = "this is a test"; for (int x = 0; x < food.length(); x++) { if (food.charAt(x) == letter) { y++; } } System.out.println(y); } }