/* The program does simple addition It uses a method, asks the user for two integers Then it sums up the integers and returns the sum Finally, it prints out the sum in the main method * */ import java.util.Scanner; public class MethodAdd { public static void main(String[] args) { // Prints out the Sum System.out.println("The sum is: " + Sum()); } /* This is a value return method It asks the user for two integers Then it sum up the integers and returns the sum * */ public static int Sum() { Scanner key = new Scanner(System.in); int x, y; int sum = 0; System.out.println("Enter the first integer: "); x = key.nextInt(); System.out.println("Enter the second integer: "); y = key.nextInt(); sum = x + y; return sum; } }