class Wrap
{
public void add(Integer o)
{
String str = o.toString();
int i = o.intValue() + 5;
str = Integer.toString(i);
o = Integer.valueOf(str);
System.out.println(o.intValue());
}
public static void main(String args[])
{
Wrap ob = new Wrap();
Integer a = new Integer(5);
ob.add(a);
System.out.println(a.intValue());
}
}
The output of the prog is 10 and 5 whereas it should be 10 and 10 as original object 'a' gets modified int the add method. Kindly explain.