This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes .length Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark ".length" Watch ".length" New topic
Author

.length

William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 986

I know I can say ".length" on an array. Where is this defined? Can I say anything else, like ".size" maybe?


Please ignore post, I have no idea what I am talking about.
Ron Newman
Ranch Hand

Joined: Jun 06, 2002
Posts: 1056
.length is a fundamental property of any array. It's "defined" in the Java Language Specification.
Since an array is an Object, you can also call methods such as equals(), hashCode(), getClass(), notify(), wait(), etc.


Ron Newman - SCJP 1.2 (100%, 7 August 2002)
James Chegwidden
Author
Ranch Hand

Joined: Oct 06, 2002
Posts: 201
Yes, since arrays are objects .length is an instance variable.


Author and Instructor, my book
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 986

> It's "defined" in the Java Language Specification.
Which is what I am asking. Is it in java.lang.*, java.io.*? Where is it?
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
http://java.sun.com/docs/books/jls/second_edition/html/arrays.doc.html
Array is not a Java class in the sense that you will find it in the API. (There is an Array class but it is part of the reflecyion API).


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 986

Thanks - that is what I was looking for.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: .length