• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

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

 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Agree Roel, Array has length property, that variable needs to be changes.
 
Enthuware Software Support
Posts: 4768
52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So a final variable is not a variable but a property?
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 4768
52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 41774
887
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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".
 
Can't .... do .... plaid .... So I did this tiny ad instead:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic