my code is not working properly.
there is a 2d array and the args array. if any of the str[][] arrays match the command line arguments, it should return true, therefore java TwoDArray fgu should return true. but everytime i run this code the output is always false. does anyone know what i've done wrong?
class TwoDArray {
public static void main(String[] args) {
String[][] str = {
{"a","d"},
{"d","q","t","x"},
{"f","g","u"}
};
System.out.println(areIdentical(args,str));
}
static boolean areIdentical(String args[], String str[][]) {
for(int i = 0; i < str.length; i++) {
int count = 0;
for(int j = 0; j < str.length; j++) {
if(str[i].length != args.length) break;
if(str[i][j] != args[j]) break;
else count++;
}
if(count == str[i].length) return true;
}
return false;
}
}