• 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
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

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

 
Sheriff
Posts: 11338
177
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".
 
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.
 
Enthuware Software Support
Rancher
Posts: 4212
35
  • 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: 11338
177
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
Rancher
Posts: 4212
35
  • 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: 11338
177
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
 
author & internet detective
Marshal
Posts: 38687
677
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: 11338
177
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".
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!