You are not logged in.

#1 2015-06-10 09:46:39

husnain
User RankUser RankUser RankUser RankUser RankUser Rank
Administrator
From: Chichawatni,Pakistan
Registered: 2014-10-03
Posts: 8,129
Website

Class Test:

Question:
class Test
{

public static void main(String [] args)
{
Integer i = new Integer(0);
add(i);
System.out.println(i);
}

static void add(Integer i)
{
int val = i.intValue();
val+=3;
i = new Integer(val);
}

}
What would be the output?

Option A):
2
Option B):
Runtme Exception
Option C):
Compile Error
Option D):
0

Correct Answer is Option D):
0


You cannot discover the new oceans unless you have the courage to lose the sight of the shore.

2015-06-10 09:46:39

Advertisement
Ads By Google

Re: Class Test:



Board footer