What is the result of the following program execution?

public class Main {
    public static void main(String[] args) {
        String testString = "This is a test string.";
        String[] resultArray = testString.split(" ");
        System.out.println(resultArray.length);
    }
}
Explanation
split() method is used to decompose a specified string into an array of substrings based on a given regular expression. In the given example case, a space character is used as a separator.

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Продолжайте изучать
тесты по Java
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты