Ask Question

int[] num = new int[100]; for (int i = 0; i < 50; i++) num[i] = i; num[5] = 10; num[55] = 100; What is the value of num. length in the array above?1. 02. 1003. 994. 101

+5
Answers (1)
  1. 16 July, 03:35
    0
    Option 2: 100

    Explanation:

    The given code is regarding a Java array. To create an array in Java, the syntax is as follows:

    type [] arrayname = new type[size]

    In Java, this is possible to set a size for an array by giving an integer within the bracket. For example, int [] num = new int[100] will set the array size 100 for num. This means the num can hold 100 components within the array.

    Once the size is set for an array, the size cannot be changed in later stage.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “int[] num = new int[100]; for (int i = 0; i < 50; i++) num[i] = i; num[5] = 10; num[55] = 100; What is the value of num. length in the ...” 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