Math Class

Find minimum of two numbers using Math.min

Want to learn quickly?
Try one of the many quizzes. More than Java 400 questions with detailed answers.

Add Comment

  • In your example of min for long arguments, the arguments are really ints, thus Math.min(int,int) is called instead of Math.min(long,long). The following would be correct:
    /*
    * To find minimum of two long values, use
    * static long min(long l1, long l2) method of Math class.
    */

    System.out.println(Math.min(48092840L,4230843L));

Sponsors

Facebook Fans

Online Shopping – Flipkart