SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Does height member still retain value of 11 (after modify() invocation) because I am making a direct reference change to member height?
Thanks
Vijay Saraf.
rich tana wrote:Thanks. As in C/C++, there is a clear distinction between the 2 between the dot operator and -> operator. There seems to be no clear distinction you can see in Java code. I am just trying to distinguish between the 2 just by looking at Java code or is this possible? I do understand the difference but just need to see it in the actual code.
Thanks
All code in my posts, unless a source is explicitly mentioned, is my own.
rich tana wrote:Once again, thanks Ruben. Is it possible to provide an example of the syntax you are explaining? This will clear it up pretty quickly.
All code in my posts, unless a source is explicitly mentioned, is my own.
rich tana wrote:You rule Ruben. Thanks so much! Now, here is another question. If I change to:
The result should of: System.out.println("Value of reference y parameter after increment is: " + y.x);
should be y=1 instead? If so, I definitely got it!!
All code in my posts, unless a source is explicitly mentioned, is my own.
SCJP 1.6, SCWCD 5.0, SCBCD 5.0 [loading..]
rich tana wrote:Oops. Sorry typo. Here it is corrected:
All code in my posts, unless a source is explicitly mentioned, is my own.
rich tana wrote:Sorry to be a dodo Ruben, but this brings me back to my original confusion, why does this not work then?
As opposed to pass-by-value semantics as on p 215,
void bar() { Foo f=new Foo(); doStuff(f); }
void doStuff(Foo g) { g.setName("Boo"); g=new Foo(); }
In another way to reword the book, is this assumption correct?
I cannot change any f/g member in doStuff() since it is not making a direct reference change and doing it through a setter like setName().
All code in my posts, unless a source is explicitly mentioned, is my own.
rich tana wrote:AS with the code from below (K&B book pg 215):
It says you cannot change the state of f or I am proving to be seeing things again. Maybe I am putting way too much effort into this?
All code in my posts, unless a source is explicitly mentioned, is my own.
All code in my posts, unless a source is explicitly mentioned, is my own.