0
Tis also no output
//Methods with Reference arguments class A { int x; void add() { System.out.println(" X : "+x); } } class Sample { A o1; void test(A o2) { this.o1=o2; o2.add(); } } class Demo3 { public static void main(String aa[]) { A ss1=new A(); ss1.x=5000; new Sample().test(); } }
3 Answers
+ 2
your version should not even compile.
try
new Sample().test(ss1);
+ 2
Roland's correct. Output is 5000 with the change.
0
ref is passed in tis method ah roland