Problem with tutoial 32 in java beginner section

+3 Albo Coder · October 10, 2014
I want to know why the values of bucky[] changed when the change() method was executed. In C++ that wouldn't change the values unless you used pointer for the method.

Please help me understand WHY

Post a Reply


Oldest  Newest  Rating
+1 Arnab Banerjee · October 10, 2014
When The change method is executing, the value of bucky[ ] is incremented by 5, and the new value is stored..
actually in java you are executing both of the methods under same class and I reckon In C++ you don't do it.. >.
may be this makes the difference..
0 Albo Coder · October 12, 2014
Oh... LOL... The reference is broken so a new object is created... That's genious. So arrays are passed by reference in Java. COOL!!!! That's way better. THANKS TO BOTH OF YOU!!!! 
I appreciate your help!! 
  • 1

Java / Android Development


Very popular language used to create desktop applications, website applets, and Android apps.

Bucky Roberts Administrator