Byte equals(Object obj)
compares this object to the specified object.
The result is true if the argument is not null and is a Byte object that contains the same byte value as this object.
equals
has the following syntax.
public boolean equals(Object obj)
equals in class Object
equals
has the following parameters.
equals
returns
true if the objects are the same; false otherwise.
In the following code shows how to use Byte.equals(Object obj) method.
public class Main { public static void main(String[] args) { Byte byte1 = new Byte("1"); Byte byte2 = new Byte("2"); System.out.println(byte1.equals(byte2)); } }
The output: