Friday, February 14, 2020

BytesTest in java program

 BytesTest in java program

import java.util.Scanner;
import java.io.*;
class BytesTest
{
public static void main(String arg[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter a byte number: ");
String num=sc.nextLine();
Byte b1=new Byte(num);
System.out.println("Enter a another byte number: ");
num=sc.nextLine();
Byte b2=Byte.valueOf(num);
int n=b1.compareTo(b2);
    if (n==0)
            System.out.println ("Both are Same");
                else if(n>0)
                System.out.println (b1 + "is bigger");
                    else
                    System.out.println (b2 + " is bigger");
}
}

No comments:

Post a Comment