Scanner scan = new Scanner(System.in);
System.out.println("Enter letter: ");
a = scan.next();
int count = 0;
for (int i = 0; i < a.length(); i++) { ...
Type: Posts; User: Rend
Scanner scan = new Scanner(System.in);
System.out.println("Enter letter: ");
a = scan.next();
int count = 0;
for (int i = 0; i < a.length(); i++) { ...
if ((word.indexOf(a)!=-1))
This is not the right way to check through the string for a letter. What you're actually doing is checking the index of the letter you are looking for (in this case "a")...