public class OneA { public int product( int [] a ) { int product = 1; for ( int i = 0; i < a.length; i++ ) { product *= a[i]; } return product; } }
the above code should give me results like the following:
product(new int[] {1, 2, 3, 4, 5}) -> 120
product(new int[] {2, 3, 7}) -> 42
i know the code is right but how do i test it in the terminal? after compiling the class i.e javac OneA.java, what should be the next command in the terminal?