SCJP Module-1 Question-29


 

SCJP Module-1 Question-29

The Sample program given below will test your understanding about the methods in Java.

The Sample program given below will test your understanding about the methods in Java.

Given a sample code:

1    class Test3 {

2    public Integer showval;

3    public void methodOne() {
4    Integer i = new Integer(1);
5    showval = i;
6    methodTwo(i);
    }

7    private void methodTwo(Integer val) {
8    val = val.intValue();
9    System.out.print(val + " ");
    }

10    public static void main(String[] args) {
11    Test3 t = new Test3();
11    t.methodOne();
12    t.methodTwo(9);
    }}

What will be the result? Choose the correct option?

(A) 1 9
(B) 9 1
(C) Compilation error at line no-5
(D) Compilation error at line no-8

Answer:

(A)

Ads