Find maximum of two numbers using Math.max - Java Language Basics

Java examples for Language Basics:Math

Description

Find maximum of two numbers using Math.max

Demo Code


 
public class Main {
 
  public static void main(String[] args) {
    System.out.println(Math.max(20,40));
     System.out.println(Math.max(3.4f,4.4f));
     System.out.println(Math.max(6.34,13.45));
     System.out.println(Math.max(499999,500000));
  }//from w ww.  ja v  a  2 s.c  o m
}

Result


Related Tutorials