import java.util.Scanner; /** * This class contains methods that accept parameters. */ public class ParamMethod { /** * main simply will call our method */ public static void main(String[] args) { System.out.println("Hello from main (before method call)"); Scanner sc = new Scanner(System.in); int num = sc.nextInt(); displayInt(num); System.out.println("In main, returned from method displayInt."); System.out.println("Answer to 98*64 is: " + multiply(98,64)); // or I can assign the return value to a variable int val2=98, val1=64; int answer = multiply(val2, val1); } /** * displayInt displays the value of the parameter to the screen * @param num the number to display to the screen */ public static void displayInt(int num) { System.out.println(num); } /** * multiply -- multiplies the two parameters * @param val1 first operand * @param val2 second operand * @return val1 times val2 */ public static int multiply(int val1, int val2) { // a local variable has scope in this method int product = val1*val2; return product; } }