0
我正在通过表匹配名称匹配的客户,如果找到,那么我想返回该客户,否则返回null。问题是我一直都是空的,我认为我的问题是在if for循环中。Java - 在表中搜索匹配字符串的对象
公共类testter {
public Customer isCustomerInTable(Customer[][] table, String customerName) {
for (int r = 0; r < table.length; r++) {
for (int c = 0; c < table[r].length; c++) {
if (table[r][c].equals(customerName)) {
return table[r][c];
}
}
}
return null;
}
}
我的客户类:
任何想法?由于
只要我完成提交的问题我得到了我自己的答案,但因为你的正是我的想法。我会给你信用,谢谢 –
很高兴帮助! :) – SudoRahul