i have a problem that i have been working on. i'm in need of some desperate help for someone can show me how to make this program work.
import java.util.Scanner;
import java.io.*;
public class LettersCounter
{
public static void main(String[] args) throws IOExceptions
{
//needed for scanner class
Scanner keyboard = new Scanner(System.in);
int charCount = 0;
String filename;
String userString;
// get users string
System.out.println("Please enter a file name: ")
String userString = keyboard.nextLine();
// get users character
System.out.print("Please enter a character: ");
char userChar = keyboard.nextLine().charAt(0);
// tell the user what the program does
System.out.println("\n****This program will return how many times" +
" the character you entered showed up in" +
" the string you entered.****");
for(int i= 0;i<userString.length();i++)
{
if (userString.charAt(i) == userChar)
{
charCount++;
}
}
System.out.println("\nThe specified character " +"\"" + userChar +
"\" is inside the string " + userString +
" "+ charCount + " times.\n");
}
}
this program has been keeping me up. i need some help