Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

arg.length

 
ramchander yshetti
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 624
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 48954
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20529
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read the two posts above yours carefully. The answer has already been given.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic