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(" ");
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.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Sign Up Now
or Subscribe for future quizzes