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; }
if (str.startsWith("hi")){
ReplyDeletereturn true;
}
return false;
Thanks for providing best java solutions. I appreciate your efforts. You can also check best iOS app development company in usa.
ReplyDelete