mixStart

Return true if the given string begins with “mix”, except the ‘m’ can be anything, so “pix”, “9ix” .. all count.

mixStart(“mix snacks”) ? true
mixStart(“pix snacks”) ? true
mixStart(“piz snacks”) ? false

public boolean mixStart(String str) {
if(str.length()<3) return false;
else return(str.substring(1,3).equals("ix"));
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s