what is difference between length() and length | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what is difference between length() and length

28th Jun 2017, 6:05 PM
Prakhar
Prakhar  - avatar
3 Answers
+ 10
length is a property which gives length of an array. On the other hand, length() is a method that returns length of a String (In Java, Strings are not considered as character arrays)
28th Jun 2017, 6:21 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 2
in the array class there's a variable named length, there's also a function named getLength (); for other Objects, there a function named length ()
28th Jun 2017, 6:44 PM
Jonas Schröter
Jonas Schröter - avatar
- 1
There is no difference :)
28th Jun 2017, 6:18 PM
Daniel S
Daniel S - avatar