aspose file tools
The moose likes Beginning Java and the fly likes args.length Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "args.length" Watch "args.length" New topic
Author

args.length

ramchander yshetti
Ranch Hand

Joined: Apr 22, 2006
Posts: 97
hai

public static void main(String args[])
{....
.....

for(int i=0;i<=args.length;i++)


can you tell me args.length(it returns the length of the array)
.length is what it is function or keyword
where it is in api.



.....
...
Ganesh Kumar
Ranch Hand

Joined: Jul 02, 2007
Posts: 113
Hi Ramachander
Length is function which returns an value of the length of the data you have given.
Gavin Tranter
Ranch Hand

Joined: Jan 01, 2007
Posts: 333
I was always thoughts arrayObject.length was actual a property, a public final variable of the "array" class and not a method, as a method requires brackets: ().
[ July 26, 2007: Message edited by: Gavin Tranter ]
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24059
    
  13

Syntactically, it's an instance member -- i.e., in the code it looks like a variable. But in reality, it is compiled to a special bytecode which returns the length of an array object; it's not a "real" instance member of the array object.

yathamshetti ramchander -- "length" isn't anywhere in the API because it's not a member of any class that's documented in the API. Instead, it's a feature of the Java language. You learn about it from the language specification, or (more likely) from any introductory Java book.

Don't worry that there are many things like this to learn. There is only one similar feature in all of Java -- one other thing that looks like a member variable, but isn't. That's the static "class" member. You can say, for example, "String.class" to get a java.lang.Class object that represents the class java.lang.String.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: args.length
 
Similar Threads
length() and length.
A problem determining the length of an int variable converted to a string..........
how to modify this program to get asending order integers?
Integer??
same errors (cannot find symbol) for two codes