Question: complete codingbat question: For each character 'a' that you see in a string, add 1, and then return the sum. getNumberOfAs(string) 0 getNumberOfAs(aadrvark) 3 getNumberOfAs(amy)

complete codingbat question:

For each character 'a' that you see in a string, add 1, and then return the sum.

getNumberOfAs("string") 0 getNumberOfAs("aadrvark") 3 getNumberOfAs("amy") 1

given code:

public int getNumberOfAs(String str) { }

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!