Qtr No. 213, New Town Yehlanka Indore 454775
Predict the output of the given code. (Assume all the necessary imports are done.)
public class Main {
public static void main(String[] args) {
int[] arr = { 70, 50, 30, 10, 20, 40, 60 };
int value = findValue(arr);
System.out.println(value);
}
private static int findValue(int[] array) {
int h = Integer.MIN_VALUE;
int s = Integer.MIN_VALUE;
for (int i : array) {
if (i > h) {
s = h;
h = i;
} else if (i > s) {
s = i;
}
}
return s;
}
}
No output
10
70
60
To get all Infosys Certified Java SE11 Developer Exam questions Join Group https://bit.ly/infy_premium_group
We're passionate about offering best placement materials and courses!! A one stop place for Placement Materials. We daily post Offcampus updates and Placement Materials.
Qtr No. 213, New Town Yehlanka Indore 454775
admin@prepflix.in