id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

findFirstAorB


Returns the index of the first letter "a" or the first letter "b" in the String parameter (also called an argument), whichever comes first. Returns -1 if the String parameter does not contain the letter "a" or "b." Note that the String parameter is all lower case.


findFirstAorB("criteria") → 7
findFirstAorB("proverb") → 6
findFirstAorB("publication") → 2

...Save, Compile, Run (ctrl-enter)

public int findFirstAorB(String word){ }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 194 Post-solution available

Copyright Nick Parlante 2017 - privacy