0

Please help decribe the below code where solve(grade) is int array

int[] result = solve(grades); for (int i = 0; i < result.length; i++) {            System.out.print(result[i] + (i != result.length - 1 ? "\n" : "")); }

1st Mar 2018, 1:08 PM
Bahubali
Bahubali - avatar
1 Resposta
+ 4
If i is for the last array entry, concatenate a new line "\n" to the string. For every other array entry, concatenate a empty string. (condition ? trueResult : falseResult) if the condition is true, this expression returns the trueResult value. Otherwise, the falseResult value is returned.
1st Mar 2018, 1:20 PM
John Wells
John Wells - avatar