What is the output of the following code?
public class Test{ public static void main(String args[]){ double[] myList = {1, 5, 5, 5, 5, 1}; double max = myList[0]; int indexOfMax = 0; for(int i = 1; i < myList.length; i++){ if(myList[i] > max){ max = myList[i]; indexOfMax = i; } } System.out.println(indexOfMax); } }
A.0
B.1
C.2
D.3
Answers
Answered by
4
Hola friends...
=============
Option B :- 1
is the correct answer.....
=============
Option B :- 1
is the correct answer.....
Answered by
0
heya..
Here is your answer...
What is the output of the following code?
B.1
It may help you..☺☺
Here is your answer...
What is the output of the following code?
B.1
It may help you..☺☺
Similar questions
English,
7 months ago
Computer Science,
7 months ago
Physics,
7 months ago
Computer Science,
1 year ago
Computer Science,
1 year ago
Social Sciences,
1 year ago
Political Science,
1 year ago
Geography,
1 year ago