This code is not that difficult but I'm a little confused as to what some of it means. It's goal is to return a new string made of every other character starting with the first.
I don't get what String result = "";
means. Is that null
?
public String stringBits(String str)
{
String result = "";
int i = str.length();
for(int j = 0; j<i; j+=2)
{
result = result + str.substring(j, j+1);
}
return result;
}
Any help would be appreciated. Thanks