Math class is part of java.lang package. Math min method returns the smallest lowest value of two numbers. If value is negative, it will return lowest value nearest to positive value. min function return type is double. min method find lowest smallest value between 2 number and compare two value to get smallest number.
Math min example explains how to use Math min function in java.
public class JavaMathMinExample { public static void main(String[] args) { double E1 = Math.min(34.45, 23.67); double E2 = Math.min(14.45, 23.67); double E3 = Math.min(-14.45, -23.67); System.out.println("Math min value :"+E1); System.out.println("Math min value :"+E2); System.out.println("Math min value :"+E3); } }
Output
Math min value :23.67
Math min value :14.45
Math min value :-23.67
Tags: Math




Link to Us