Question: how to correctly take in a array and string parameter that looks for a city and prints out all the information using toString which has

how to correctly take in a array and string parameter that looks for a city and prints out all the information using toString which has all the information

public static void lookUp(City [] cit, String n ){
 for(int i = 0; i < cit.length; i++){
  if(cit[i].name.equals(n)){
   System.out.println(cit[i].name);
   System.out.println(cit.toString());
  }
 }
}


Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!