You are here: Home / Topics / Program to Find maximum number in Java

Program to Find maximum number in Java

Filed under: Java on 2023-08-12 20:42:01

// Simple if else example

public class IfElse{
   public static void main(String[] args) 
   {
      int a = 23, b = 47, c;
  
      if(a>b)
      {
          System.out.println("a is greater than b");
      }
      else
      {
          System.out.println("a is less than or equal to b");
      } 
   }
}

Output:

a is less than or equal to b

About Author:
J
Java     View Profile
Hi, I am using MCQ Buddy. I love to share content on this website.