I can get the size(length) of any array (let a[]) by a.length. please tell me what is this "length" word actually signifies, where it is defined in java and what is its actual definition ?

Showing Answers 1 - 6 of 6 Answers

Shunmugar Raja

  • Mar 24th, 2006
 

Me too not sure about that strange "length".One thing that i am sure is "length" is a property.It is not a method and all.It may be a public property that is defined for Array Type (int[], char[]., String[], Vector[])..

  Was this answer useful?  Yes

length is not a method ,It is a varaible which identifies the length of the array by subtracting one with the index position of (null)'/0'.

postion of the index at present - 1 ---------> gives the len of the variable

( so subtractin the one represent the postion of the index )

So the index postion is stored in the vairable called length

  Was this answer useful?  Yes

K.V.N.R.MURALI KRISHNA

  • Mar 29th, 2006
 

if you use an array ,we use length key word to know the size of an array. because array used primitive data types.

if you use String then you use length() method. which returns the size of the string.which stores an objects.

  Was this answer useful?  Yes

Nishi

  • Mar 31st, 2006
 

          As we are having the type called array in Java... All the array which has the instantiation(ie., new arraytype[size]) will atomatically has the integer variable with the name length(It is a variable not a method). Whenever the array size declared it holds the length of that Array instance in the variable called length...

          Another piece of Information it is Static Variable....

  Was this answer useful?  Yes

srinivas

  • May 17th, 2006
 

hi,
In case of Array, lenght is called a member variable.In case of Strings and
Files it is a method. so in this case we ().
okey.... bayeeeee....
keeps smiling and mailing
bora_srinivasarao@yahoo.co.in

if any want java material & doubts regarding j2se ,j2ee plz send mail to

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions