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);
}
}
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.
Login in to like
Login in to comment