008-006-002
Return Value: Maximum Value Finder Method
Easy
Problem Description
Return Value: Maximum Value Finder method
Learning Objective: Understand how to define and use methods with return values
In this problem, you will create a program that defines a method accepting two integers as parameters and returning the larger value as int, then displays the result to standard output.
Create a method that receives two integers and returns the larger one. Learn how to specify the return type (int) and use the return statement to return a value.
Input
Line 1: First number (integer)
Line 2: Second number (integer)
Output
Max: [larger value]
Test Cases
※ Output examples follow programming industry standards
Input:
10 20
Expected Output:
Max: 20
Input:
50 30
Expected Output:
Max: 50
Input:
25 25
Expected Output:
Max: 25
Input:
0 0
Expected Output:
Max: 0
❌ Some tests failed
Your Solution
Current Mode:● My Code
99
1
2
3
4
5
6
7
8
9
10
›
⌄
⌄
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Write your code here
sc.close();
}
}
0 B / 5 MB
You have 9 free executions remaining
