Java Long example to find the maximum and minimum of numbers using max and min
By candid | Posted :
Dec 9, 2016
| Updated :
Dec 9, 2016
public static long max(long a,long b)
Returns the greater of two long values as if by calling Math.max.
public static long min(long a,long b)
Returns the smaller of two long values as if by calling Math.min.
Program:
package com.candidjava;
public class LongMaxMin
{
public static void main(String a[])
{
Long i=8,j=15;
System.out.println("The maximum value is "+Long.max(i, j));
System.out.println("The minimum value is "+Long.min(i, j));
}
}
Output:
The maximum value is 15
The minimum value is 8
Description:
The maximum and minimum values are being found out.