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
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
C
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
This is the right answer
scratch that, your code is different, C is correct
C
Correct answer is D