Hi, I need clarification about why these two scenarios produce different type of results.
When you have something like:
y=3, not 7.
However, when you have something like this:
a.size =20, not 10.
What causes this difference? I'm guessing it has to do something with the difference in primitive variables and object reference variables, but I'm not entirely sure. I'm new to both Java and programming in general, so can someone explain this to me? Thanks.
Hi Ameem : Welcome to the ranch. With just a quick look you'll see
that you created just one object with new, but with two reference
variables for it. So you can use either variable to change the object's
state or to look at it.
Jim ... ...
BEE MBA PMP SCJP-6
Joined: May 24, 2010
Thank you both for the help! It is now clear to me.