Ask 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. size - 1

? arr. length ()

+1
Answers (1)
  1. 31 July, 20:06
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers