public static void sentencesChecker(String essay) {

    int count = 0;

    int countcap = 0;

    int i , j;
    for ( i = 0; i < essay.length(); i++) {

        if (essay.charAt(i) == '.') {
            count++;
        }
       for ( char e= 'A'; e<='Z';e++) {
           if (essay.charAt(i)==e){

                countcap++;
           }

        }

    }

    System.out.print("\n\t\t" + countcap + "out of " + count + "sentences start with a capital letter");
}

I see you failed to test this code, because it doesn't get anywhere near the stated functionality.
If you don't understand why try these test strings:

"This data has one sentence starting with a CAPITAL letter."
"this has none, says James."
"An ellipsis looks like this: ... .
"É is a latin capital letter E acute, Unicode: U+00C9, UTF-8: C3 89."
"What about this one? It has zero periods!"

.., ad that's without getting into what happens if any of the interesting characters are inside a quotation.

Listen: It's good that you are posting and contributing here, but for your own reputation you should be more careful about the quality of what you post.

_Anu_6,
Have you made any progress on testing your sentencesChecker(String essay) {.....} function as suggested by JamesCherrill?
Do you know how to test the your code?

Anu_6 ,
To find a sentences start with a capital letter read a first word of the sentence and check is start with upper case.
Character.isUpperCase(word.charAt(0))
-Anand

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.