Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

length of array, page 124 (Java OCA 8 Programmer I Study Guide)

 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hooray, nitpicking time!

In the first paragraph on page 124 you can read
Java OCA 8 Programmer I Study Guide wrote:and disguises it by using the length variable


But in the example statements I can't find a length variable, I only see the length property of an array being used. So I would change "variable" to "property".
 
Suresh Regmi
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Agree Roel, Array has length property, that variable needs to be changes.
 
Paul Anilprem
Enthuware Software Support
Ranch Hand
Posts: 3817
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So a final variable is not a variable but a property?
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Anilprem wrote:So a final variable is not a variable but a property?

Didn't say that at all.

It could be "field" as well. Or I could even agree with "instance variable" because every array is an Object and it has a public instance variable length (although I think this could be really confusing for some readers). But if I read "the length variable", I expect to see something like
 
Paul Anilprem
Enthuware Software Support
Ranch Hand
Posts: 3817
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, the sentence in question is in reference to the code given just above it. The code contains numbers.length. It does look like a variable to me. Indeed, if you had a class with an instance variable or a "field" named length and a variable named numbers, this is exactly how you would use it i.e. numbers.length.
I was thinking that you are objecting to the word variable for length because it cannot be changed. Now it looks like you are objecting because it is not defined like int length = 5? May be I'm not understanding you correctly.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Anilprem wrote:Now it looks like you are objecting because it is not defined like int length = 5?

That's indeed the reason why I'm nitpicking here
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Logged saying it should be "field." I agree that "variable" is misleading.

Roel De Nijs wrote:It could be "field" as well. Or I could even agree with "instance variable" because every array is an Object and it has a public instance variable length

Um. Only arrays have length, not every Object.

 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:
Roel De Nijs wrote:Or I could even agree with "instance variable" because every array is an Object and it has a public instance variable length

Um. Only arrays have length, not every Object.

Yeah, that statement could have been much more clear. For complete clarity: "it" was (of course) meant to refer to "every array" and not to "every Object".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic