This is the code I can't understand why v.i take 20! The result of this code is:
15 0
20
Code:
class Value {
public int i = 15;
}
class tes {
public static void main(String argv[]) {
tes t = new tes();
t.first();
}
public void first() /* methode first */
{
int i = 5;
Value v = new Value(); /* appel au classe Value */
v.i = 25;
second(v, i);
System.out.println(v.i);
} /* here it appears 20 ????? */
public void second(Value v, int i) {
i = 0;
v.i = 20;
Value val = new Value();
v = val;
System.out.println(v.i + " " + i);
}
} /* it appears 15 0 i understand this */