The program needs to count and display the number of times that the specified charector appears in the text file.
Currently turning up zero for the total. I\'m not i
BufferedReader reader = new BufferedReader(new FileReader("somefile.txt")); int ch; char charToSearch='a'; int counter=0; while((ch=reader.read()) != -1) { if(charToSearch == (char)ch) { counter++; } }; reader.close(); System.out.println(counter);
Is this of any help?