Java equals () method - the comparison function

Java equals () method - the comparison function

Blog Description

Information in the article involved from the Internet and organize personal conclusion, meaning that the individual learning experience and summary, what if infringement, please contact me to delete, thank you!

Explanation

equals () method is used to compare a string specified object, in the String class.

equalsIgnoreCase () is case-insensitive

usage

public static void main(String args[]) {
        String Str1 = new String("Hello");
        String Str2 = "hello";
        retVal = Str1.equals( Str2 );
        System.out.println("返回值 = " + retVal );  
    }

note

If the comparison is a constant and a variable, constant EDITORIAL

return value

If the strings are equal Returns true given object; false otherwise

thank

Rookie Tutorial

Universal Network

And a hardworking own

He published 183 original articles · won praise 491 · views 20000 +

Guess you like

Origin blog.csdn.net/qq_45163122/article/details/105035361