What is the result?

Given the code fragment:

What is the result?

Given the code fragment:

What is the result?

A.
Java 7

B.
Java 6

C.
Java 7, Java 6

D.
Java 7
java 6

E.
Java

Explanation:

regex: Java / one or more anything !!! / ends with a digit
so it is the source string



Leave a Reply 6

Your email address will not be published. Required fields are marked *


Humberto Bañuelos Flores

Humberto Bañuelos Flores

public static void main(String[] args) {
String s=”Java 6, Java 7″;
Pattern p=Pattern.compile(“Java.\\d”);
Matcher m=p.matcher(s);
while (m.find()) {
System.out.println(m.group());
}

}

Java 6
Java 7

FF

FF

This is the right answer

FF

FF

scratch that, your code is different, C is correct

Klyaksa

Klyaksa

Correct answer is D