✏️ Explanatory Question
Write the difference between length and length() functions.
-
length:
- It is a property (not a method) used with arrays in Java.
- Returns the number of elements in the array.
-
length():
- It is a method used with strings.
- Returns the number of characters in the string.