part of my program includes my boolean 2d array: boolean[][] matrix = new boolean[V][V];
i want to iterate through the vertex and check if it is true but am getting error: cannot convert from boolean[] to boolean. casting (boolean)
does not help. i have also tried boolean[v][w] == true
.
here is where i am having the problem:
public int degree(int v) {
int degreeCounter = 0;
for(int i = 0; i < v; i++){
if(matrix[v]){ //<---- problem here!
degreeCounter++;
}
}
return degreeCounter;
}
Any insight is greatly appreciated!