+ 2

What is the difference between length and length()

3rd Aug 2019, 3:32 PM
Prataparao Sai Vamsi
Prataparao Sai Vamsi - avatar
2 ответов
+ 8
length is a property while length() is a method. For classes that have some mention of a length, some have it as a property while some have it as a function that returns the actual length.
3rd Aug 2019, 3:33 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
0
eg int[] array = {1,2,3,4,5}; int len = array.length; int len2 = "some string".length();
3rd Aug 2019, 10:08 PM
zemiak