jQuery in Action, 2nd edition*
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark ".length" Watch ".length" New topic


William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 984

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
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: 984

> 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
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: 984

Thanks - that is what I was looking for.
I agree. Here's the link: http://aspose.com/file-tools
subject: .length
Similar Threads
About header
questions from java prepare
2 dimensional Array!
length of input stream
How to find the length of the array