Home / Questions / Write the difference between length and length() functions.
Explanatory Question

Write the difference between length and length() functions.

👁 94 Views
📘 Detailed Answer
🕒 Easy to Read
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.

Answer with Explanation

  • 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.