Write the difference between length and length() functions.

Views 16

Answer:

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

Related Articles:

This section is dedicated exclusively to Questions & Answers. For an in-depth exploration of Java Programming Language, click the links and dive deeper into this subject.

Join Our telegram group to ask Questions

Click below button to join our groups.