Question: I am trying to create a letter counter program that simply counts occurences of a character in a string. I am unsure why the code

I am trying to create a letter counter program that simply counts occurences of a character in a string. I am unsure why the code is not compiling. If you could just fix and explain, it would be much appreciated.

import java.util.*;

public class LetterCounterPC5 { public static void main(String{} args) { //variable declaration int count = 0; String inputstring; String str; char character; //create a scanner class Scanner keyboard = new Scanner(System.in); //user enters string System.out.println("Enter a string"); //read string inputstring = keyboard.nextLine(); //user enters char System.out.println("Enter a character"); //read char str = keyboard.nextLine(); character=str.charAt(0); //loop to find frequency of char in string for(int i=0; i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!