Question: What would be the result of compiling and running the following program? Select the one correct answer. (a) The code will not compile, because the
What would be the result of compiling and running the following program?
![public class MyClass { public static void main (String[] args) { int](https://dsd5zvtm8ll6.cloudfront.net/images/question_images/1706/8/7/7/47465bce222036361706877472714.jpg)
Select the one correct answer.
(a) The code will not compile, because the array type int[] is incorrect.
(b) The program will compile, but will throw an ArrayIndexOutOfBoundsException when run.
(c) The program will compile and run without error, but will produce no output.
(d) The program will compile and run without error, and will print the numbers 0 through 19.
(e) The program will compile and run without error, and will print 0 twenty times.
(f) The program will compile and run without error, and will print null twenty times.
public class MyClass { public static void main (String[] args) { int size = 20; int [] arr new int[ size ]; m } for (int i= 0; i < size; ++i) { System.out.println (arr [i]); }
Step by Step Solution
3.39 Rating (158 Votes )
There are 3 Steps involved in it
e The array declaration is valid and will declare and ... View full answer
Get step-by-step solutions from verified subject matter experts
