7:55 pm - Thursday April 25, 2019

Short Example Program for equals(Object obj)

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044
/**
Author :candidjava.com
Description: Program using SHORT equals () method
*/
public class Equals
{
public static void main(String args[]) throws Exception
{
short s1=34;
short s2=34;
Short t=new Short(s1);
Short r=new Short(s2);
boolean b=t.equals(r);      // Compares this object to the specified object
                                                 true if the objects are the same; false otherwise.
System.out.println(b);
}
}

OUTPUT:

true

BACK

Filed in: Z-A All Java Codes

Comments are closed.