Question: Which of the following is a valid way to initialize an array in Java? A ) int [ ] numbers = 1 , 2 ,
Which of the following is a valid way to initialize an array in Java?
A int numbers ;
B int numbers new int ;
C int numbers new int ;
D All are not valid
What will be the output of the following code?
arr ;
System.out.printlnarrlength;
A
B
C
D
What will be the output of the following code?
int arr ;
System.out.printlnarrarrlength ;
A
B
C
D ArrayIndexOutOfBoundsException
Which of the following will correctly iterate through all elements of a D array? arr
A for int ; arr.length; for int ;;;arr;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
