Error: class X is public should be declared in a file named X.java
Name of public class must match the name of .java file in which it is placed (like public class Foo{} must be placed in Foo.java file). So either: rename your file from Main.java to WeatherArray.java rename the class from public class WeatherArray { to public class Main {