Vote count:
0
Hey can someone please explain this coding line by line?
public boolean twoE(String str) {
int count = 0;
for (int i=0; i<str.length(); i++) {
if (str.charAt(i) == 'e') count++;
}
if (count == 2) return true;
return false;
// this last if/else can be written simply as "return (count == 2);"
asked 2 mins ago
Aucun commentaire:
Enregistrer un commentaire