Difference between length and length() methods in java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Difference between length and length() methods in java?

26th Apr 2022, 12:09 PM
Sajid Junejo
Sajid Junejo - avatar
1 Answer
+ 4
length is an attribute which is used with arrays of any kind to get it's size. Whereas length() is a method specifically used with Strings and returns the number of characters.
26th Apr 2022, 12:14 PM
Avinesh
Avinesh - avatar