We would like to know how to read Integers from console and calculate.
import java.util.Scanner; // w w w . jav a2s .co m public class MainClass { public static void main( String args[] ) { Scanner input = new Scanner( System.in ); int x; int y; int z; int result; System.out.print( "Enter first integer: " ); x = input.nextInt(); System.out.print( "Enter second integer: " ); y = input.nextInt(); System.out.print( "Enter third integer: " ); z = input.nextInt(); result = x * y * z; System.out.printf( "Product is %d\n", result ); } }
The code above generates the following result.