WebMD Health interview question

Count occurrences of character in a given string in java