Relation of two numbers in java

  • admin on February 4, 2019
  • Likes!
Hello friends! Welcome to my website.

 Java programming to find the two number how to related to each other is greater than or less than or equal? This java language programming is free all type of errors like compiler and runtime errors and this programming is tested to compile and then run the program code.
Here is only programming code only with their output.

Find the relation of two numbers java programming language.

     //—-Code Start—-
     import java.util.*;

    class test2 { //test class
        int a, b;
        // class object
        public void relate_number(int a, int b) {
            if (a                 System.out.println(a + ” is less than ” + b);
            if (a                 System.out.println(a + ” is lass than or equal to ” + b);
            if (a == b) {   //third condtion
                System.out.println(a + ” equal to ” + b);
            if (a >= b) {   //fourth condtion
                System.out.println(a + ” is greater than or equal to ” + b);
            if (a > b) {    //fivth condtion
                System.out.println(a + ” is greater than to ” + b);
    public class relation {
        public static void main(String args[]) {
            Scanner c = new Scanner(;
            //making object of the class test2
            test2 o = new test2();
            System.out.print(“Please Enter the Frist Number: “);
            o.a = c.nextInt();
            System.out.print(“Please Enter the Second Number: “);
            o.b = c.nextInt();
            System.out.println(“The Numbers are relate as Following: “);
            o.relate_number(o.a, o.b);
    //—-Code End—–

      Output:  Please Enter the Frist Number: 5
                    Please Enter the Second Number: 5
                  The Numbers are related as Following:
                  5 is less than or equal to 5
                    5 equal to 5
                  5 is greater than or equal to 5

I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any dought about this java programming code or input & output please comment below
If you have other question about java programming send an email by contacting us form are given on page right side.
Thank You!

Article Categories:
Programs in java

Leave a Reply

Your email address will not be published. Required fields are marked *