The Mumbly Blog

Monday, October 13, 2008

Java arrays and strings

The length of an array is an attribute.

String [] testArray = {"this", "that"};
System.out.println(testArray.length);


The length of a string is a method.


String test="Hello there";
System.out.println(test.length());