public class StringMatches {
public static void main(String args[]) {
String str = "string", str1 = "matches";
boolean result = str1.matches("jsp");
System.out.println("Method returns 'false': " + result);
result = str.matches("string");
System.out.println("Method returns 'false': " + result);
result = str.matches("string");
System.out.println("Method returns 'true': " + result);
}
}
|