Java implementation of the equals method
KW.java
class KW { public static void main(String args[]) { String s1="HELLO WORLD"; String s2=s1; String s3="Hello World"; boolean b; b=s1.equals(s2); System.out.println(b); b=s2.equals(s3); System.out.println(b); b=s1.equalsIgnoreCase(s3); System.out.println(b); } }
Output
kodingwindow@kw:~$ javac KW.java
kodingwindow@kw:~$ java KW true false true kodingwindow@kw:~$
Comments and Reactions
What Next?
Java implementation of the compareTo and equals methods
Java implementation of the string split method
Java program to count the number of holes in a given string and number
Advertisement