nabakumar
Posts: 23
Nickname: nkmeitei
Registered: Jun, 2005
|
|
Re: length variable in arrays
|
Posted: Jun 9, 2005 4:32 AM
|
|
When u declare a new array ,say whose members are of type "String" we write like this : String[] str; str is not an object of type String its simply an array whose members are of type String class Then when you create an aray u give like this str = new String[10]; The purpose of the new operator is to reserve memory for 10 members ,ie String in this case. To get the size of the array we use str.length , here length is not a method ,length is a property provided by the Java platform for all arrays
|
|