Квиз по Java: Strings & String Methods

This Java strings quiz tests the String methods you use every day and the traps around them. You will predict the output of substring, indexOf and split, compare strings the right way and see why strings never change in place.

Лёгкий 10 вопроса ~5 минуты Проходной балл: 80% Java 17

Выберите режим

Вы играете как гость: войдите, чтобы сохранить XP и серию.

Пример вопроса

Вопрос 1 из 10

What does this print?

public class Main {
    public static void main(String[] args) {
        String s = "Hello";
        s.toUpperCase();
        System.out.println(s);
    }
}
Показать ответ

B. Hello Strings are immutable: toUpperCase() returns a new string and leaves s alone. The result is thrown away here; write s = s.toUpperCase(); to keep it.

Что проверяет этот квиз

  • Strings are immutable
  • == vs equals() and equalsIgnoreCase()
  • substring, indexOf, charAt and their index rules
  • split and empty trailing strings
  • Concatenating null and using StringBuilder

Частые вопросы

Нужен ли аккаунт?

Нет. Играть может любой. Войдите, чтобы сохранять XP, серию, значки и историю.

Можно пройти ещё раз?

Да. Лучший результат сохраняется, а вопросы и ответы каждый раз перемешиваются.