java - What is wrong with this nested for loop? -
this question has answer here:
i cannot life of me work out why nested loop isn't working.
public void getmagsabovex(double minimummag) { for(observatory myobservatory : monitoring) { for(earthquake myearthquake : earthquakes) { if(myearthquake.returnmagnitude() > minimummag) { system.out.print(myearthquake.returnmagnitude() + ", "); } } } } i error "cannot find symbol - variable earthquakes" far know earthquakes name of second arraylist want iterate through. if change 'earthquakes' arraylist() error "-> expected". don't know doesn't like.
first : in javadoc comments methods methods "return" something. don't though. both methods void.
and long call getmagsabovex(minimummag) on object of type observatory inside listmagsabovex method, don't see fail.
you should post full methods if want more though.
Comments
Post a Comment