You dont have to give me the answer, just please point me in the right direction! Thanks.
Here is the question: Write a program that asks the user to enter a string, and then asks the user to enter a character. the program should count and display the number of times that the specified character appears in the string.
Here is what i have so far:
import java.util.Scanner;
public class letterCounter
{
public static void main(String[] args)
{
String creation; //This is the users imported string
String character; //This is the character the user enters
char letter;
Scanner keyboard = new Scanner(System.in); //This reads users inputs
System.out.println("Please enter a sentance.");
creation = keyboard.nextLine();
System.out.println("Now, please enter a letter.");
character = keyboard.nextLine();
letter = input.charAt(0);
}
}
I get an error stating that "cannot find system variable input"
please guide me as to what to do next!!
Thx
2006-11-28
05:56:53
·
4 answers
·
asked by
Anonymous
in
Computers & Internet
➔ Programming & Design