Java Programming
Accenture PrimermediumJava Programming05 Regular Expression

Accenture Java Programming Practice Question

Predict the output of the below code : import java.util.regex.*; public class TestRegEx{ public static void main(String args[]) { Pattern p = Pattern.compile(".ech"); Matcher m = p.matcher("tech"); boolean b = m.matches(); System.out.println(b); } }

Answer options

A
util.regex.*; public class TestRegEx{ public static void main(String args[]) { Pattern p = Pattern.compile(".ech"); Matcher m = p.matcher("tech"); boolean b = m.matches(); System.out.println(b); } }
B
false
C
true
D
Runtime Error

Correct answer: true

Explanation

Correct answer: true.

Related Accenture Java Programming questions

Practice more Accenture Java Programming questions

PrimerDumps has 1400+ primer questions, 2026 mocks and coding hands-on — all free.