Menu
Question Index
...

What is the output of the following program?

import java.util.regex.*;

public class RegularEx {
    public static void main(String... arg) {
        Pattern pattern = Pattern.compile("M+", 5);
        Matcher matcher = pattern.matcher("M Merit Match MM m mM");
        while (matcher.find())
            System.out.print(matcher.group() + " ");
    }
}


M M M MM M
M M M MM m mM
M M M MM mM
M Merit Match MM m mM
PatternSyntaxException

Doubts

Problems

Topic: Java Regular Expression

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App