length – arrays (int[], double[], String[]) —- to know the length of the arrays.

length() – String related Object (String, StringBuilder etc)to know the length of the String

size()– Collection Object (ArrayList, Set etc)to know the size of the Collection

length is not a method, so it completely makes sense that it will not work on objects. Its only works on arrays.

Comments are closed.