public class MainClass { public static void main(String args[]) { String candidate = "Java 6"; String pattern = "Java \\d"; System.out.println(candidate.matches(pattern)); }}