public class Testat1 {
public static int countOccurance(char [][] characters, char toCount) {
int sum=0;
for (char i=0;i<characters.length;i++) {
for (char j=0;j<characters[i].length;j++) {
if(characters[sum]==characters[toCount]) {
return sum++;
}
}
}
return sum++;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
char[][]array={{1,2,3},{1,3,4}};
System.out.println((countOccurance(array))); // der zweite Parameter fehlt
//es wird ein Array und ein Char erwartet das Array hast du das Char nicht.
}
}
public class Testat1 {
public static int countOccurance(char[][] characters, char toCount) {
int sum = 0;
for (int i = 0; i < characters.length; i++) {
for (int j = 0; j < characters[i].length; j++) {
if (characters[i][j] == toCount) {
sum++;
}
}
}
return sum;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
char[][] array = {{'1', '2', '3'}, {'1', '3', '4'}};
System.out.println(countOccurance(array, '3'));
}
}