6
answers
0
watching
412
views
4 Sep 2018
17. What does the following piece of code print? public class Test public static void main(String[] args) int[] a = {2,4,6,8); for(int i = 0; i < a.length; i++) int() b = foo (a); System.out.print( b[i] + " "); public static int[] foo (int[] array) for (int i = 0; i < array.length; i++) array[i]++; return array; (A) 3 579 (B) It would give compile-time error. (C) 3 6 9 12 (D) It would give run-time error. (E) 2468
17. What does the following piece of code print? public class Test public static void main(String[] args) int[] a = {2,4,6,8); for(int i = 0; i < a.length; i++) int() b = foo (a); System.out.print( b[i] + " "); public static int[] foo (int[] array) for (int i = 0; i < array.length; i++) array[i]++; return array; (A) 3 579 (B) It would give compile-time error. (C) 3 6 9 12 (D) It would give run-time error. (E) 2468
16 Feb 2023
Already have an account? Log in
miopicdreamLv3
21 Jul 2022
Already have an account? Log in
Deanna HettingerLv2
6 Sep 2018
Already have an account? Log in