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

 

srp4379@lausd.net 3-stringbasics-quiz > first4Letters
prev  |  next  |  chance

public String first4Letters(String str)

Given a String, return ONLY its First 4 letters.

If it has fewer than 4 letters, just return the string itself unchanged.


first4Letters("be") → "be"
first4Letters("1") → "1"
first4Letters("bad") → "bad"

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

public String first4Letters(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: 10

Copyright Nick Parlante 2017 - privacy