aspose file tools*
The moose likes Ranch Office and the fly likes Rule Round-up #8 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Ranch Office
Bookmark "Rule Round-up #8" Watch "Rule Round-up #8" New topic
Author

Rule Round-up #8

Ajit Deshpande
Greenhorn

Joined: Jun 15, 2000
Posts: 17
The wording of Question #8 is not very clear. It says:
When you pass a reference to an array as an argument to a method call, you pass a new reference to the original array.(True or False)
You actually pass a copy of the reference and not a new reference.
paul wheaton
Trailboss

Joined: Dec 14, 1998
Posts: 20692
    ∞

#8: TRUE or FALSE: When you pass a reference to an array as an argument to a method call, you pass a new reference to the original array.
The answer is: TRUE - An array is an object, and Java always passes a copy of the reference to the original object. Both references now point to the same array object.
Hmmm, changing this to "you pass a copy of the reference..." might be a good idea.
Anybody else?


permaculture Wood Burning Stoves 2.0 - 4-DVD set
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Yeah, it is clearer the second way. I think the first is OK, but the word "new" has mixed connotations which it's best to avoid.


"I'm not back." - Bill Harding, Twister
paul wheaton
Trailboss

Joined: Dec 14, 1998
Posts: 20692
    ∞

I've made the change.
 
jQuery in Action, 2nd edition
 
subject: Rule Round-up #8