Table of Contents

equals

Compares object and indecates if they equal

equals(Object); 
 
return value: boolean true/false

equals Example in java

String a = "42";
String b = "144";
 
if ( a.equals(b) ) { 
 
    System.out.println(b+" is the answer");
} else {
 
    System.out.println(b+" is probably not the answer");
}

output

   144 is probably not the answer