在 verifyPlate 方法中,如何在数组 Plates 中搜索某个字符串“platenum”,然后将布尔值返回给 main 方法?
import java.util.Scanner;
import java.util.Date;
import java.io.*;
public static boolean verifyPlate(String[] plates, int numCars, Scanner keyboard)
{
Scanner s = new Scanner(System.in);
System.out.print("Enter your plate number: ");
String platenum = s.nextLine();
boolean real=false;
for (int i=0;i!=plates.length;i++)
{
boolean platers = platenum.equals(plates[i]);
if(platers)
{
System.out.println("Your vehicle is registered");
}
else
System.out.println("Your vehicle is not registered");
platers=real;
}
return real;
}