java String equalsIgnoreCase() 方法示例.


java String equalsIgnoreCase() 方法示例.

import java.lang.*;

public class StringDemo {

   public static void main(String[] args) {

      String str1 = "sachin tendulkar";

      String str2 = "amrood admin";

      String str3 = "AMROOD ADMIN";



      //Checking for equality with case ignored

      boolean retval1 = str2.equalsIgnoreCase(str1);

      boolean retval2 = str2.equalsIgnoreCase(str3);



      //Prints the return value

      System.out.println("str2 is equal to str1 = " + retval1);

      System.out.println("str2 is equal to str3 = " + retval2);

   }

}