Java > Warmup-1 > startHi (CodingBat Solution)

Problem:

Given a string, return true if the string starts with "hi" and false otherwise.

startHi("hi there") → true
startHi("hi") → true
startHi("hello hi") → false


Solution:

public boolean startHi(String str) {
  if (str.startsWith("hi"))
    return true;
  else
    return false;
}


2 comments :

  1. if (str.startsWith("hi")){
    return true;
    }
    return false;

    ReplyDelete
  2. Thanks for providing best java solutions. I appreciate your efforts. You can also check best iOS app development company in usa.

    ReplyDelete

Follow Me

If you like our content, feel free to follow me to stay updated.

Subscribe

Enter your email address:

We hate spam as much as you do.

Upload Material

Got an exam, project, tutorial video, exercise, solutions, unsolved problem, question, solution manual? We are open to any coding material. Why not upload?

Upload

Copyright © 2012 - 2014 Java Problems  --  About  --  Attribution  --  Privacy Policy  --  Terms of Use  --  Contact