| Author |
where to check the length instance variable for an Array
|
sai prasanna
Ranch Hand
Joined: May 02, 2005
Posts: 167
|
|
hi all we have length instance variable for an array how to view this instance variable as we view methods in java API thanks in advance sai prasanna
|
 |
Stan James
(instanceof Sidekick)
Ranch Hand
Joined: Jan 29, 2003
Posts: 8791
|
|
An array is an object and it is an instance of a class which ought to document the length attribute. I don't think it's in the API docs at all, though. Arrays are one of those dirty little corners in the language where they can say "Everything works like this ... except array" You can try to explore the class through reflection. This much works: Look into the Class class for ways to explore the methods and attributes.
|
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12921
|
|
Your question is not clear. The "length" property that arrays have in Java is not a real instance variable. It's just a special Java keyword. It's part of the Java language, not of the standard API, so it isn't documented in the API documentation. What is it exactly that you want to know?
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
Dan Patterson
Greenhorn
Joined: Jan 27, 2005
Posts: 24
|
|
|
Actually, length is a read-only data field that specifies the number of elements in the array.
|
 |
Vlado Zajac
Ranch Hand
Joined: Aug 03, 2004
Posts: 244
|
|
|
It is not defined in API doc, it is defined in the Java Language Specification
|
 |
 |
|
|
subject: where to check the length instance variable for an Array
|
|
|