【发布时间】:2013-12-04 09:19:42
【问题描述】:
我必须将用户输入的内容与名称数组进行比较,如果为真,则返回真,否则返回假,到目前为止我有这个
public static boolean employeeReport(Employee[] emp, String[] lastName) throws IOException
{
System.out.println("Type out the last name of the employee you are looking for: ");
Scanner scan = new Scanner (System.in);
String Name = scan.next();
// ...
}
我正在考虑创建一个 for 循环并将“名称”与我拥有的字符串数组的每个单独值进行比较。有什么帮助吗?
【问题讨论】:
-
也许您应该提及您使用的语言!?
标签: java arrays if-statement for-loop equals