008-001-006
Method Definition: Sum Calculation Method
Easy
Problem Description
Method Definition: Sum Calculation Method
Learning Objective: Define and call method with return value
Create method that calculates sum of two numbers. Define sum method, return and display result.
Input
Line 1: Number 1 (integer)
Line 2: Number 2 (integer)
Output
Sum: [result]
Test Cases
※ Output examples follow programming industry standards
Input:
10 20
Expected Output:
Sum: 30
Input:
5 15
Expected Output:
Sum: 20
Input:
0 0
Expected Output:
Sum: 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
