What is the output of the following piece of code?public class array { public static void main(String args[]) { int []arr = {1,2,3,4,5}; System.out.println(arr[2]); System.out.println(arr[4]); } } - Study24x7
Social learning Network

Warning: include(./views/auth.php): failed to open stream: Permission denied in /var/www/html/live/loginRightSlider.php on line 18

Warning: include(): Failed opening './views/auth.php' for inclusion (include_path='.:/usr/share/php') in /var/www/html/live/loginRightSlider.php on line 18
15 Mar 2019 10:29 AM study24x7 study24x7

What is the output of the following piece of code?public class array { public static void main(String args[]) { int []arr = {1,2,3,4,5}; System.out.println(arr[2]); System.out.println(arr[4]); } }

A

3 and 5

B

5 and 3

C

2 and 4

D

4 and 2

study24x7
Write a comment
Related Questions
500+   more Questions to answer
Most Related Articles