Ask Question
Yesterday, 23:49

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. Today, 02:35
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers