Menu
Question Index
...

What is the output of the following program?

public class RegEx {
    public static void main(String[] args) {
        String input = "Hello Welcome to Merit Campus";
        String[] result1 = input.split("\\s");
        String[] result2 = input.split("\\d");
        String[] result3 = input.split("\\S");
        System.out.println(result1.length + " " + result2.length + " " + result3.length);
    }
}


5 1 20
5 0 5
20 0 5
5 0 0
Compilation Error

Doubts

Problems

Topic: Additional String Methods in Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App