# Program in Java to find maximum of 3 numbers

A method /function is defined by the user as per the requirement of the user/ programmer . To implement

a user define function , a programmer must contain the following statements .

- Function initialization
- Method call i-e math.max();

Here, the code of the maximum of 3 numbers by using max function is given below:

### Program to find maximum of 3 numbers in Java

Please input three numbers or integers: 10 30 25

So, the maximum of these numberes is : 30

import java.util.*;

import java.util.Scanner;

public class Java {

public static void main(String[] args) {

Scanner input = new Scanner(System.in);

System.out.println(“Please input 3 integers: “);

int x = Integer.parseInt(input.nextLine());

int y = Integer.parseInt(input.nextLine());

int z = Integer.parseInt(input.nextLine());

int max= Math.max(a,b);

if(max>y){

max= Math.max(a,c);

}

else{

max= Math.max(b,c);

}

System.out.println(“The max of three is: ” + max);

}

}

This is the program for finding the maximum of three numbers. Scanner Class is used to take the input from the user and max function is the pre-defined function in JAVA class which is used to calculate and finds out the maximum number from the given input and shows the output to the user through print function.

Comment if you have any confusion or query thanks !!!