What is the difference between
length() in Java?
array.length - final variable applicable for arrays that tells us what is the size of the array.
string.length() - a method which is applicable for string object, that returns the number of characters in the string.
.length - built-in field (array length):
String array = new String; // new char, new int, etc. System.out.println(array.length); // 5
.length() - public method (
String length, etc.):
String string = "12345"; System.out.println(string.length()); // 5