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

 

longerThan4


public boolean longerThan4(String s)

Given a string, return true if the number of letters is greater than 4.

public boolean longerThan4(String s) {
  boolean answer = false;
  int len = s.length();
  if (len > 4) {
    answer = true;
  }
  return answer;
}

longerThan4("") → false
longerThan4("12345") → true
longerThan4("1234") → false

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

public boolean longerThan4(String s) { }

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

Copyright Nick Parlante 2017 - privacy