Question: Given the following code, what is printed? private static int doSomething (int[] arr) { int val= 0; } for(int i = 0; i <
Given the following code, what is printed? private static int doSomething (int[] arr) { int val= 0; } for(int i = 0; i < arr.length; i+=1) { val + arr[i]; } } return val + arr.length; public static void main(String[] args) ( int[] arr = new int [13]; arr [0]= 6; arr [1] = 9; arr [0] = 8; arr [2] = 0; arr [3]= 9; arr [8] = 4; System.out.println(doSomething (arr));
Step by Step Solution
There are 3 Steps involved in it
Lets analyze the code step by step First you initialize an array arr of length 13 and set some val... View full answer
Get step-by-step solutions from verified subject matter experts
