Java implementation of the equals method
GD.java
class GD { 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
godarda@gd:~$ javac GD.java
godarda@gd:~$ java GD true false true godarda@gd:~$
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