• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Rule Round-up #8

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Trailboss
Posts: 23192
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
#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?
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
paul wheaton
Trailboss
Posts: 23192
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've made the change.
 
You have to be odd to be #1 - Seuss. An odd little ad:
ScroogeXHTML 9.0 - RTF to HTML5 and XHTML converter
https://coderanch.com/t/731949/ScroogeXHTML-RTF-HTML-XHTML-converter
    Bookmark Topic Watch Topic
  • New Topic