« Back
package com.string; public class StringComparison { public static void main(String args[]) { String s1 = "coders"; String s2 = "arts"; String s3 = "Coders"; String s4 = new String("arts"); System.out.println(s2.equals(s4)); System.out.println(s2.equals(s3)); System.out.println(s1.equalsIgnoreCase(s3)); System.out.println(s2==s4); System.out.println(s1.compareTo(s2)); System.out.println(s1.compareTo(s3)); System.out.println(s2.compareToIgnoreCase(s4)); } }
true
false
true
false
2
32
0
×
Report a Problem:
Description:
Submit