Which, inserted at line 8, produces the output 30?

Given:
1. class Test {
2. public static void main(String args[]) {
3. int num1 = 10, num2 = 20, result;

4. result = calc(num1, num2);
5. System.out.println(result);
6. }
7.
8. // insert code here
9. }
Which, inserted at line 8, produces the output 30?

Given:
1. class Test {
2. public static void main(String args[]) {
3. int num1 = 10, num2 = 20, result;

4. result = calc(num1, num2);
5. System.out.println(result);
6. }
7.
8. // insert code here
9. }
Which, inserted at line 8, produces the output 30?

A.
static int calc(int n1, int n2) { return n1 + n2; }

B.
static void calc(n1, n2) { return (n1 + n2); }

C.
public int calc(int n1, int n2) { return; }

D.
static int calc(int n1, int n2) { return; }

E.
public int calc(int n1, int n2) { return n1 + n2; }

F.
static int calc(int n1, n2) { return n1, n2; };



Leave a Reply 0

Your email address will not be published. Required fields are marked *