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

 

jebbert@volusia.k12.fl.us > bbb1same
prev  |  next  |  chance

Write a method that compares the 'first' few characters of two strings. If the strings match for those 'first' characters, return those matching characters. Otherwise return a string that says "no match". Note that 'first' will always be a positive integer smaller than the length of the shortest string.


bbb1same(7, "This is a test", "This is not a test") → "This is"
bbb1same(3, "What?", "Just happened?") → "no match"
bbb1same(3, "this", "that") → "no match"

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

public String bbb1same(int first, String str1, String str2) { }

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

Copyright Nick Parlante 2017 - privacy