Here you see a part of a program that creates different Valhold objects; What's the difference? public static void main (String args[]) v = new Valhold /Valhold created v.another(v,i) /Call Valhold methode with Valhold-Object /*------------- v = new Valhold another(v,i) / What does this? System.out.println(v.i) public void another (Valhold v, int i){ v.i = 10 }
------------------
Anonymous
Ranch Hand
Joined: Nov 22, 2008
Posts: 18944
posted
0
sorry but i do not understand your code. -- missing {} -- v.i do declare a instance variable i somewhere? etc.......... so if you can send a more complete code
------------------ Benjamin l�onard evisor www.evisor.com
Thomas Markl
Ranch Hand
Joined: Mar 08, 2001
Posts: 192
posted
0
Here you see a part of a program that creates different Valhold objects; What's the difference? public static void main (String args[]) v = new Valhold /Valhold created v.another(v,i) /Call Valhold methode with Valhold-Object /*------------- v = new Valhold another(v,i) / What does this? System.out.println(v.i) public void another (Valhold v, int i){ v.i = 10 } ----------- Given the following code what will be the output? class ValHold{ public int i = 10; } public class ObParm{ public static void main(String argv[]){ ObParm o = new ObParm(); o.amethod(); } public void amethod(){ int i = 99; ValHold v = new ValHold(); v.i=30; another(v,i); System.out.println(v.i); }//End of amethod public void another(ValHold v, int i){ i=0; v.i = 20; ValHold vh = new ValHold(); v = vh; System.out.println(v.i+ " "+i); }//End of another }