Java Program to find Minimum from two numbers

Java Programming : In this tutorial we have given the source code and program output to find the minimum number between two numbers entered by the user using command line argument.

Java Program to find Minimum from two numbers using command line arguments.

class Minof2{

      public static void main(String args[]){

      //taking value as command line argument.

      //Converting String format to Integer value

      int i = Integer.parseInt(args[0]);

      int j = Integer.parseInt(args[1]);

      int result = (i<j)?i:j;

      System.out.println(result+" is a minimum value");

  }

}

Output of Java Program to find Minimum from two numbers


0 comments:

Post a Comment