equals() / Reference

  • String str1 = "CCCP";
    String str2 = "CCCP";
    // Tests to see if 'str1' is equal to 'str2'
    if (str1.equals(str2) == true) {
      println("Equal");  // They are equal, so this line will print
    } else {
      println("Not equal");  // This line will not print
    }