📜  在 java 中如何比较两个字符串 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:45.063000             🧑  作者: Mango

代码示例1
class scratch{
    public static void main(String[] args) {
        String str1 = "Nyello";
        String str2 = "Hello";
        String str3 = "Hello";

        System.out.println( str1.equals(str2) ); //prints false
        System.out.println( str2.equals(str3) ); //prints true
    }
}