the below program is supposed to read the string you input and count the amount of times that the letter 'a' appears in it. if it doesn't find the letter 'a', it's supposed to tell you that there aren't enough arguments (which i may change to say that "there aren't any 'a' characters or something) but i'm stuck and i don't know exactly what else to do.
//Page 297 Exercise 8.4
//Saying program found x # of this character in string.
public class Test
{
//variables
char a = a;
{
public static void main(String[] args)
{
if (args.length != 2)
{
System.out.println("Not enough arguments");
}
else
{
Count(args[0], args[1].charAt(0));
}
}
public static int Count(String str, char a)
{
int charCount = 0;
System.out.print(str);
System.out.print(a);
for (int i = 0; i<str.length(); i++)
{
if (str.charAt(i) == a)
{
charCount ++;
}
return charCount;
}
}
}
}