Java Language / Java Math

It is used to perform mathematical operations / tasks on numbers.

Program to find maximum of 2 numbers. Output
public class MyClass
{
public static void main(String[] args)
{
System.out.println(Math.max(5, 10));
}
}
10
Program to find minimum of 2 numbers. Output
public class MyClass {
public static void main(String[] args)
{
System.out.println(Math.min(5, 10));
}
}


Home     Back