This week's book giveaway is in the OCP forum.
We're giving away four copies of OCP Java SE 8 Programmer II Exam Study Guide and have Kathy Sierra, Bert Bates, & Elizabeth Robson on-line!
See this thread for details.
Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

about length property  RSS feed

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
we know that length is final property ...for arrays...
in which class it will be present..?
any ideas...
 
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you explain a bit more what you want to know ?
 
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Krish is talking about class in javadocs.
 
Mani Venkata Kanth
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
length is a property...right?

it should be in some class....

i want to know that class???
 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
PLS CORRECT ME IF IM WRONG...

length is an attribute of an Array object. if you look at the API in the Array class there is a static method called getLength() which returns the length of an array...

do you know the relationship between static variables and and static methods? so by the look of the static method getLength(), i think we can safely assume that Array has a static variable called length which can also be access with Array.length;

so to answer your question, see the Array class in the API.
 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Krish DP:
length is a property...right?

it should be in some class....

i want to know that class???



Arrays are directly supported language features. You can find the length of an Array using getLength() method of Array class in java.lang.reflect package.
[ August 25, 2006: Message edited by: praveen babu ]
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Run the following little program and the class for String[] will be revealed:

[ August 25, 2006: Message edited by: Barry Gaunt ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!