Answer:
import java.util.Scanner; //mentioned in the question.
public class ArraysKeyValue { //mentioned in the question.
public static void main (String [] args) { //mentioned in the question.
final int SIZE_LIST = 4;
//mentioned in the question.
int[] keysList = new int[SIZE_LIST];
//mentioned in the question.
int[] itemsList = new int[SIZE_LIST];
//mentioned in the question.
int i;
//mentioned in the question.
keysList[0] = 13;
//mentioned in the question.
keysList[1] = 47;
//mentioned in the question.
keysList[2] = 71;
//mentioned in the question.
keysList[3] = 59;
//mentioned in the question.
itemsList[0] = 12;
//mentioned in the question.
itemsList[1] = 36;
//mentioned in the question.
itemsList[2] = 72;
//mentioned in the question.
itemsList[3] = 54;//mentioned in the question.
// other line to complete the solution is as follows--
for(i=0;i<(keysList.length);i++) //Loop to access all the element of keysList array variable.
{// open for loop braces
if(keysList[i]>50) // compare the value of keysList array variable with 50.
System.out.println(itemsList[i]); // print the value
}// close for loop braces.
}// close main function braces.
} //close the class braces.
Output:
72
54
Explanation:
In the solution part--
- One loop is placed which moves from 0 to (size-1) of the 'keyslist' array.
- Then the 'if' statement is used to check the element of 'keyslist' array, which is greater than 50 or not.
- If it is greater, then print the element of item_list array of 'i' index which is also the index of greater value of keyslist array element.