I'm trying to build an ArrayList of Earthquake
objects but Java is complaining about not being visible.
My Code:
import java.io.*;
import java.util.Arrays.*;
public class ObservatoryTest {
private ArrayList <Earthquakes> listOfEarthquakes; //This list is not visible
Earthquakes Quake1 = new Earthquakes(4.5,"cheese",1995);
Earthquakes Quake2 = new Earthquakes(6.5,"fish",1945);
Earthquakes Quake3 = new Earthquakes(10.5,"Chorizo",2015);
public void buildList(Earthquakes... args){
for(Earthquakes myEarthquake : args){
listOfEarthquakes.add(myEarthquake);
}
}
}
My aim is to build a list of Earthquake objects. Could somebody tell me why and how to fix my code? Thanks
--------------edit--------------------
The error message is the type ArrayList is not visible
however changing visibility modifier to public doesn't have any effect.