Question: 1. Show three ways to declare a one-dimensional array of 3 float. 2. Which of the following statements are invalid? a) float numberl; b) intnumber

1. Show three ways to declare a one-dimensional array of 3 float. 2. Which of the following statements are invalid? a) float numberl; b) intnumber [1, 2, 3,41 c) double number new double[23]; d) float number 1.0f, 2.0f; e) number new array [23]; 3. What is the output for the following codes? int x 30 int[] numbers = new int [x]; x-60 System.out.println("x is "+ x); System.out.printIn("The size of number is + numbers.length); 4. What happens when your program attempts to access an array element with an invalid index? 5. Once an array is created, its size cannot be changed. Does the following code resize the array? int [] myList myList new int 10]: //Some time later you want to assign a new array to myList myList-new int[20]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
