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

 
 

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

Advertisement

Related Tags for SCJP Module-1 Question-29:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 21, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com