Home Tutorial Java Scjp Part1 SCJP Module-1 Question-29

 
 

SCJP Module-1 Question-29
Posted on: July 21, 2010 at 12:00 AM
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)

Related Tags for SCJP Module-1 Question-29:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.