I wrote a program to read a .txt file and return how many times a, e, s, and t occur in the .txt file. I am getting an error that I do not know how to fix. It says Error: FileNotFoundException cannot be resolved to a type
Any help would be appreciated
import java.util.Scanner;
import java.io.File;
import java.io.IOException;
import java.io.BufferedReader;
public class Count
{
public static void main (String[] args) throws FileNotFoundException {
String phrase; // a string of characters
int countBlank; // the number of blanks (spaces) in the phrase
int length; // the length of the phrase
char ch; // an individual character in the string
int countA;
int countE;
int countS;
int countT;
java.io.File file = new java.io.File("counting.txt");
Scanner inFile = new Scanner (file);
Scanner scan = new Scanner(System.in);
phrase = scan.nextLine();
length = phrase.length();
// Initialize counts
while (true)
{
if (phrase.equalsIgnoreCase("quit"))
break;
else
{
countBlank = 0;
countA = 0;
countE = 0;
countS = 0;
countT = 0;
for ( int i = 0; i < length; i++ )
{
if ( phrase.charAt( i ) == ' ' )
countBlank++;
ch = phrase.charAt(i);
switch (ch)
{
case 'a':
case 'A': countA++;
break;
case 'e':
case 'E': countE++;
break;
case 's':
case 'S': countS++;
break;
case 't':
case 'T': countT++;
break;
}
}
System.out.println ();
System.out.println ("Number of blank spaces: " + countBlank);
System.out.println ();
System.out.println ("Number of A's: " + countA);
System.out.println ();
System.out.println ("Number of E's: " + countE);
System.out.println ();
System.out.println ("Number of S's: " + countS);
System.out.println ();
System.out.println ("Number of T's: " + countT);
break;
}
}
}
}