Consider this method:
public static String doSomething(String s)
{
final String BLANK = " "; //BLANK contains a single space
String str = ""; //empty string
String temp;
for (int i = 0; i < s.length(); i++)
{
temp = s.substring(i, i + 1);
if (!(temp.equals(BLANK)))
str += temp;
}
return str;
}
Which of the following is the most precise description of what doSomething does?
(A) It returns s unchanged.
(B) It returns s with all its blanks removed.
(C) It returns a String that is equivalent to s with all its blanks removed.
(D) It returns a String that is an exact copy of s.
(E) It returns a String that contains s.length() blanks.