Home » Java Short equals() method with Examples

Java Short equals() method with Examples

by Online Tutorials Library

Java Short equals() Method

The equals() method of Short class is used to compare two objects for checking equality.

Syntax

Parameters

Obj: the object to compare with

Return value

True: If both object are same.

False: If both object are different.

Example1: (Both object same)

Test it Now

Output:

short Obj1 55 and short Obj2 55  are same : true   

Example 2: (Both object different)

Test it Now

Output:

short Obj1 65 and short Obj2 85  are same : false  

Next TopicJava Short

You may also like