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

 

andersoniii.edwin@cusd80.com > findTheFours
prev  |  next  |  chance

FindingThe4's. Write the method that accepts a string of characters (str) and returns the count of the number of occurrences of "4". Be sure to check the string for length as if it is empty, return zero fours. Example: "ABCD4EFG" would return 1.


findTheFours("AABCD4EFG") → 1
findTheFours("4A4B4C4D") → 4
findTheFours("This is fun 4 me") → 1

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

public int findTheFours(String str) { }

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: 101

Copyright Nick Parlante 2017 - privacy