Math.max only takes two arguments. If you want the maximum of three, use Math.max(MY_INT1, Math.max(MY_INT2, MY_DOUBLE2)).

Answer from Jeremiah Willcock on Stack Overflow
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ java-program-to-find-maximum-of-three-numbers
Java program to find maximum of three numbers
In this program, we initialize three integer variables, num1, num2, and num3, with the values 15, -5, and 7 respectively. We then use an if statement to compare the values. We check if num1 is greater than or equal to both num2 and num3. If this condition is true, num1 is the maximum number, and ...
๐ŸŒ
Programiz
programiz.com โ€บ java-programming โ€บ examples โ€บ largest-number-three
Java Program to Find the Largest Among Three Numbers [if-else & nested if-else]
... public class Largest { public static void main(String[] args) { double n1 = -4.5, n2 = 3.9, n3 = 2.5; if( n1 >= n2 && n1 >= n3) System.out.println(n1 + " is the largest number."); else if (n2 >= n1 && n2 >= n3) System.out.println(n2 + " is the largest number."); else System.out.println(n3 ...
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ java โ€บ java-program-to-find-the-largest-of-three-numbers
Java Program to Find the Largest of three Numbers - GeeksforGeeks
import java.lang.*; import java.util.*; ... System.out.println(Collections.max(x) + " is the largest number."); } } Output ยท 10 is the largest number....
Published ย  November 21, 2020
๐ŸŒ
Medium
medium.com โ€บ @AlexanderObregon โ€บ finding-the-largest-of-three-numbers-with-java-conditions-dcc219fdcb9e
Finding the Largest of Three Numbers with Java Conditions
August 21, 2025 - Learn how to find the largest of three numbers in Java with if-else, Math.max, and the ternary operator, and see how the JVM runs these checks.
Find elsewhere
๐ŸŒ
Blogger
javarevisited.blogspot.com โ€บ 2014 โ€บ 07 โ€บ how-to-find-largest-of-three-integers-in-Java-program.html
How to Find Largest of Three Integers in Java - Algorithm, Logic Example
Logic to find the biggest of three number is as follows : Check if the first number is greater than the second and third, if Yes, then first number is largest. Check if the second number is greater than second and third, if Yes, the second number ...
๐ŸŒ
Java67
java67.com โ€บ 2019 โ€บ 05 โ€บ how-to-find-largest-and-smallest-of-three-numbers-in-java.html
How to Find the Largest and Smallest of Three Numbers in Java? [Solved] | Java67
import java.util.Scanner; /* * Java Program to find largest and smallest of three numbers */ public class Main { public static void main(String args[]) { // creating scanner to accept radius of circle Scanner scanner = new Scanner(System.in); System.out.println("Welcome in Java program to find largest and smallest of three numbers"); System.out.println("Please enter first number :"); int first = scanner.nextInt(); System.out.println("Please enter second number :"); int second = scanner.nextInt(); System.out.println("Please enter third number :"); int third = scanner.nextInt(); int largest = la
๐ŸŒ
Techcrashcourse
techcrashcourse.com โ€บ 2017 โ€บ 02 โ€บ java-program-find-largest-of-three-numbers.html
Java Program to Find Largest of Three Numbers
Else If A < B, then print the maximum of B and C. package com.tcc.java.programs; import java.util.Scanner; public class MaximumThreeNumbers { public static void main(String[] args) { int a, b, c, max; Scanner scanner; // Take three integer from user scanner = new Scanner(System.in); System.out.println("Enter Three Integer"); a = scanner.nextInt(); b = scanner.nextInt(); c = scanner.nextInt(); // Using if-else statement compare a, b and c if (a > b) { // compare a and c if (a > c) max = a; else max = c; } else { // compare b and c if (b > c) max = b; else max = c; } System.out.println("Largest Number : " + max); } } Output
๐ŸŒ
Sanfoundry
sanfoundry.com โ€บ java-program-find-biggest-3-numbers
Largest of Three Numbers in Java - Sanfoundry
May 23, 2022 - This is a Java Program to Find the Biggest of 3 Numbers. Enter any three integer numbers as an input. Now we check the first number against the second and third number. If it false then we check for second number against third.
๐ŸŒ
CodeGym
codegym.cc โ€บ java blog โ€บ java math โ€บ java math max() method
Java Math.max() method with Examples
December 5, 2024 - This Math.max() method can only take two arguments, so you canโ€™t use it to find a Maximum number in a set with more than two numbers. It has four overloading methods for int, double, float, and long data types.
๐ŸŒ
PrepBytes
prepbytes.com โ€บ home โ€บ java โ€บ greatest of three numbers in java
Greatest of Three Numbers in Java
May 18, 2023 - The ArrayList and Collections.max method approach is the most efficient for finding the largest number from three numbers in Java, especially when dealing with larger datasets. Q4. What are the advantages of the ternary operator approach for finding the largest number from three numbers in Java?
๐ŸŒ
Quora
quora.com โ€บ How-do-I-find-the-largest-of-three-integers-in-Java
How to find the largest of three integers in Java - Quora
Answer (1 of 6): General logic to find the largest of 3 numbers is like the number which is greater than the other 2 numbers. Let 3 integers be num1,num2,num3 Num1 is largest if num1>num2 and num2>num3 Similarly the other 2 numbers.
๐ŸŒ
Tutorjoes
tutorjoes.in โ€บ Java_example_programs โ€บ three_maximum_number_in_java
Write a program to find maximum between three numbers
import java.util.Scanner; class Three_Maximum { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter the Number 1 : "); int num1 = input.nextInt(); System.out.print("Enter the Number 2 : "); int num2 = input.nextInt(); System.out.print("Enter the Number 3 : "); int num3 = input.nextInt(); if(num1>num2 && num1>num3) System.out.println("Maximum Number is " +num1); else if(num1<num2 && num3<num2) System.out.println("Maximum Number is " +num2); else System.out.println("Maximum Number is " +num3); } }
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 72552095 โ€บ finding-the-maximum-of-3-numbers-user-imput-in-3-different-ways-in-java
Finding the maximum of 3 numbers (user imput) in 3 different ways, in java? - Stack Overflow
Both ways boil down to "compare two numbers, take the bigger one, repeat". ... Use one of the available sort methods then pick whichever ends up last. ... Use IntStream.max (or DoubleStream.max). ... int array[] = new int[]{10, 11, 88, 2, 12, 120}; public static int getMax(int[] inputArray){ int maxValue = inputArray[0]; for(int i=1;i < inputArray.length;i++){ if(inputArray[i] > maxValue){ maxValue = inputArray[i]; } } return maxValue; } ... int[] arrayName = new int[] {1, 2, 3}; Arrays.sort(arrayName); System.out.println(arrayName[arrayName.length - 1]);
๐ŸŒ
BeginnersBook
beginnersbook.com โ€บ 2017 โ€บ 09 โ€บ java-program-to-find-largest-of-three-numbers
Java Program to find largest of three Numbers
public class JavaExample{ public static void main(String[] args) { int num1 = 10, num2 = 20, num3 = 7; if( num1 >= num2 && num1 >= num3) System.out.println(num1+" is the largest Number"); else if (num2 >= num1 && num2 >= num3) System.out.println(num2+" is the largest Number"); else ...
๐ŸŒ
w3resource
w3resource.com โ€บ java-exercises โ€บ conditional-statement โ€บ java-conditional-statement-exercise-3.php
Java - Find the greatest of three numbers
import java.util.Scanner; public ... "); int num3 = in.nextInt(); if (num1 > num2) if (num1 > num3) System.out.println("The greatest: " + num1); if (num2 > num1) if (num2 > num3) System.out.println("The greatest: " + num2); ...