Java Program to make a comparison between numbers



Conversion between Numbers

public class DoubleComparison

{

       public static void main(String []args)

       {  

              boolean result; //declaring variable

              int a=30 , b=27 ; //value assign


              result = (a>=b)&&(b>=a); //comparison

              System.out.println(“is (30>=27)and(27>=30) ? “+result); //output


              result = (a>=b)||(b>=a);//comparison

              System.out.println(“Is (30>=27)or(27>=30) ? “+result); //output

        }


Output of the given program is :-


Is (30>=27)and(27>=30) ? false 
Is (30>=27)or(27>=30) ? true   



Leave a comment