aspose file tools*
The moose likes Beginning Java and the fly likes arg.length Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "arg.length" Watch "arg.length" New topic
Author

arg.length

ramchander yshetti
Ranch Hand

Joined: Apr 22, 2006
Posts: 97
hai
can you clear me where the arg.length.
the length is there

public static void main(String arg[])
{

int n = arg.length; // in api - i dont find length field.
length() fuction is there but length.
}
please clear where length is there
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Originally posted by ramchander yathamshetti:
length() fuction is there but length.


String contains length()
Array contains length
see the methods available in array

Hope This Helps
Mark Vedder
Ranch Hand

Joined: Dec 17, 2003
Posts: 624

You won't find the length field of an array in the Java doc APIs (as far as I know). It is just simply something you learn about when learning Java. Other than the length field, the only methods you can call on an array itself (not an element of the array, but the array itself) are the standard methods from the Object class.

As seetharaman venkatasamy pointed out, the length() method is a method of the String class, as well as the CharSequence class, StringBuffer class, and a number of other classes. (You can look them all up in the Java Doc Index.)

For some more discussion on Arrays, including their length, you can look at this recent thread.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38334
    
  23
Originally posted by Mark Vedder:
You won't find the length field of an array in the Java doc APIs
That is because you won't find "array" in the Java API documentation at all. You need to look in the Java Language Specification; look for �10.7 for "length."
ramchander yshetti
Ranch Hand

Joined: Apr 22, 2006
Posts: 97
hai
i am not cleared with the answer
int a[]={.....}
int n= a.length;

where can i find length field in javadoc
please give me clear answer.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19670
    
  18

Please read the two posts above yours carefully. The answer has already been given.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: arg.length