To allocate 50 BMI values in an array you write down inway1
To allocate 50 BMI values in an array, you write down in//way-1: int size - 50; double[] BMI = new double[size]; Could you write it this//way-2: int size = 50: double[] BM1; BM1 = new double[size]; ANS. circle Yes or No You have defined an array named: double bmi[] = new double[]; and nil it out full with contents, and you would like to access the value of second element assign the value to a variable defined as: double b; write the code for the operation. ANS: Here is an array declaration containing income values for five years consecutively: int[] income = {1200, 1000, 1700, 1300, 2000}; int i; int howManyYears = income.length;//to display the 3^rd year income, in this statement System.out.print (3^rd year income\" + income[i]; What should be the value of index i? ANS (1) What is the value of variable: how Many Years? ANS (2) ANS: (1) index i = ANS (2):
Solution
26) Yes. Both the statements are same.
27) double b = bmi[1], the array numbering starts from 0, so to access the 2nd element we use 1.
28) (1) 2 , the array numbering starts from 0, so to access the 3rd element we use 2.
(2) 5 , the value will hold the length of the array which is 5 in this case.
![To allocate 50 BMI values in an array, you write down in//way-1: int size - 50; double[] BMI = new double[size]; Could you write it this//way-2: int size = 50: To allocate 50 BMI values in an array, you write down in//way-1: int size - 50; double[] BMI = new double[size]; Could you write it this//way-2: int size = 50:](/WebImages/21/to-allocate-50-bmi-values-in-an-array-you-write-down-inway1-1047698-1761545206-0.webp)