array.length()

what's the problem with the .length method here?

String date = new String[5];

date[0] = "Hello1";

date[1] = "Hello2";

date[2] = "Hello3";

date[3] = "Hello4";

date[4] = "Hello5";

System.out.println(date.length());

The system says that it can't find length method.

Thanks

[346 byte] By [mgl0902] at [2007-9-26 1:16:27]
# 1
miss off the brackets when you are getting the length of an array System.out.println(date.length);
rob_canoe2 at 2007-6-29 0:44:19 > top of Java-index,Archived Forums,Java Programming...
# 2
For an array, length is a property, not a method.So array.length is what you need.
dewangs at 2007-6-29 0:44:19 > top of Java-index,Archived Forums,Java Programming...