Beginner advice: string.length () and string []. Length problem

Category: Java SE
2009-03-26 08:53:10

Sponsored Links
We often write this
String [] ss = new String [3];
for (int i = 0; i <ss.length; i + +)

String abc = " wo ";
int j = abc.length ();

I ask, String.length () is a method of the String class, but String []. length do not need braces? ? (I have not found the document which jdk similar java.lang.String [] stuff)

Sponsored Links

2009-03-26 08:58:14
String.length () is the String class in a method, can be found in the api.
String []. length of the array is a read-only attribute, and the array is actually a method of holding the object is a container, but with the List, Map class vessel is different, the array is not a defined class, this is rather special, it is only a read-only attribute length, it is not found in the api.
2009-03-26 09:03:32
String.length ():
a class (as a class, promising without brackets) in a way (because it is a method, so to add parentheses).

String []. length:
a variable (because there is an array, so to add in parenthesis) of an attribute (because it is a property, so without parentheses) .
2009-03-26 09:20:31
one is the method
one class of object attribute.
2009-03-26 09:34:18
array length used. LENGTH
character string with a deputy. LENGTH ()
2009-03-26 09:47:46
This problem should own to figure it out. ! ~
2009-03-26 10:05:01
popular talk:
String.length (): returns the length of the string
String []. Length: returns the length of the array, the array that defines how much Members
entirely different concepts, I hope not to confuse the landlord.
2009-03-26 10:24:21
jerrysoft (AKI) has made it very clear it.

String []. length is an attribute
String.length () is a method
2009-03-26 10:27:35
one is a method and a is an attribute, what is not clearly Yeah Yeah
java doc in there, how will finding it
2009-03-26 10:37:57
Will String []. length of this property, I have the jdk api documentation found inside how ah? ?
this String [] Where?
2009-03-26 10:48:14
I checked java2 sdk documentation, use the keyword check "length", checked down it seems that way, there is a small parenthesis?
2009-03-26 11:07:35
Array object's length property on how to find the document from the jdk?
2009-03-26 11:14:50
I understand, in fact, there is no doubt in the document to find the reason.
Domain and server ip had changed since 8/23/2013. Suspend the user registration and posts for program maintenance.