Ask Question
8 September, 07:53

Given a one dimensional array arr, what is the correct way ofgetting the number of elements in arr

? arr. length

? arr. length - 1

? arr. size - 1

? arr. length ()

+4
Answers (1)
  1. 8 September, 09:49
    0
    The answer is option 1 arr. length.

    Explanation:

    In java arr. length gives the correct number of elements in the array. The length is function is only applicable for arrays.

    The length () method is applicable for strings.

    arr. length-1 will give 1 element less.

    There is no. size for arrays in java.

    So we conclude that arr. length is correct way of getting the number of elements in one dimensional array arr.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Given a one dimensional array arr, what is the correct way ofgetting the number of elements in arr ? arr. length ? arr. length - 1 ? arr. ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers