Given the following code :
public class TestClass {
int[][] matrix = new int[2][3];
int a[] = {1, 2, 3};
int b[] = {4, 5, 6};
public int compute(int x, int y){
//1 : Insert Line of Code here
}
public void loadMatrix(){
for(int x=0; x<matrix.length; x++){
for(int y=0; y<matrix[x].length; y++){
//2: Insert Line of Code here
}
}
}
}
What can be inserted at //1 and //2?
The code listing contains two places (marked //1 and //2 ) where you need to insert the code fragments to make the given code listing compile.
Code fragments are given in the options. You have to identify which option makes sense.
If you like our products and services, please help us by posting your review here.
The code listing contains two places (marked //1 and //2 ) where you need to insert the code fragments to make the given code listing compile.
Code fragments are given in the options. You have to identify which option makes sense.
The code won't compile with the two member variables having var as their type. Is it just meant to throw us off or was making them var accidental?