I come from a php background and in php, there is an array_size()
function which tells you how many elements in the array are used.
Is there a similar
All the above answers are proper. The important thing to observe is arrays have length attribute but not length method. Whenever you use strings and arrays in java the three basic models you might face are: