Calling a Method Define a Static method 'max' with return type as 'int' in class 'ProblemSolution' that take two numbers with type 'int'. Inside the 'max' method, compare the two numbers and return the maximum of the two numbers. Then, inside the 'main' method. Define two 'int' type numbers; the first number (num1) is equal to 5 and the second number (num2) is equal to 2. At the next line, call the 'max' method where its parameter input are the two numbers above, and assign the result of the method to the variable num3 (type 'int'). Finally, on the next line, print out -> "The maximum of " + num1 + " and " + num2 + " is " + num3 Output The maximum of 5 and 2 is 5 Where, There must be space between all the words and numbers. There should not any space after the last number.
Define a Static method 'max' with return type as 'int' in class 'ProblemSolution' that take two numbers with type 'int'. Inside the 'max' method, compare the two numbers and return the maximum of the two numbers.
Then, inside the 'main' method.
Define two 'int' type numbers; the first number (num1) is equal to 5 and the second number (num2) is equal to 2.
At the next line, call the 'max' method where its parameter input are the two numbers above, and assign the result of the method to the variable num3 (type 'int').
Finally, on the next line, print out -> "The maximum of " + num1 + " and " + num2 + " is " + num3
Output
The maximum of 5 and 2 is 5
Where,
There must be space between all the words and numbers.
There should not any space after the last number
![Calling a Method
Define a Static method 'max' with return type as 'int' in
class 'ProblemSolution' that take two numbers with type
'int'. Inside the 'max' method, compare the two numbers
and return the maximum of the two numbers.
Then, inside the 'main' method.
Define two 'int' type numbers; the first number (num1) is
equal to 5 and the second number (num2) is equal to 2.
At the next line, call the 'max' method where its
parameter input are the two numbers above, and assign
the result of the method to the variable num3 (type 'int').
Finally, on the next line, print out -> "The maximum of
+ num1 + " and " + num2 + " is " + num3
Output
The maximum of 5 and 2 is 5
Where,
There must be space between all the words and
numbers.
There should not any space after the last number.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fcab43375-9d8e-42d5-87b9-87b3ba8c37de%2F0e8a360d-c99b-4923-ad49-9ca65f85b6cb%2F01lz6oi_processed.jpeg&w=3840&q=75)
![1- import java.util.*;
2
3 public class ProblemSolution {
4
5 ▼
/* Define max method here */
6
7
8
//Main method
9 ▼
public static void main(String[] args) {
10
11 ▼
12
Define the two variables and call the max method here.
13
Afterward, print out the result following the phrase given
14
by the question.
15
16
}
17
}
18](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fcab43375-9d8e-42d5-87b9-87b3ba8c37de%2F0e8a360d-c99b-4923-ad49-9ca65f85b6cb%2F7bmf1r9_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)