TRUE for any language that contains only one word for a name. (tests for any alphanumeric combination. ) - Java Language Basics

Java examples for Language Basics:String

Introduction

Notice the space character between the numeric sequence.

Demo Code

public class Main {
  public static void main(String[] args) throws Exception {
    String str = "";

    str = "I love Java 8!"; 
    boolean result = str.matches("I love .*[ 0-9]!"); 
    System.out.println(result); /*  w  ww  . j a v  a2 s  .  c o  m*/

    // The following String also matches. 
    str = "I love Jython 2.5.4!"; 
    result = str.matches("I love .*[ 0-9]!"); 

    System.out.println(result); 
    
  }
}

Result


Related Tutorials