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?

Options
- Compile Error
- 0
- 3
- Runtme Exception


CORRECT ANSWER : 0

Discussion Board
Discuss

From my pt of view in java every things are call by value..
so it will not change value of i.....

Piush 07-2-2014 01:30 PM

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement