2:03 am - Tuesday April 23, 2019

Byte Example Program for compareTo(Byte anotherByte)

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
 * @descriptions : This program explain the function and use of comparision of
 *               one byte to another byte and return value as integer
 */

class ByteValueCompare {
	
	public static void main(String arg[]) throws Exception {
	
		Byte h = new Byte("-127");
		Byte h1 = new Byte("-127");
		int i = h.compareTo(h1);// to compare one byte with another byte.
		System.out.println("Byte value=" + i);// Byte values are equal hence
												// output will be zero
	}
}

Output:
D:CandidJavalangByte>javac ByteValueCompare.java
D:CandidJavalangByte>java ByteValueCompare
Byte value=0

BACK

Filed in: Z-A All Java Codes

Comments are closed.