Олимпиадный тренинг

Задача . 16


Задача

Темы:
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.

time 1000 ms
memory 32 Mb
Правила оформления программ и список ошибок при автоматической проверке задач

Статистика успешных решений по компиляторам
Комментарий учителя