I'm a beginner developing in Java, and I have run into a bit of a problem referencing an object (from a different class) in a class.
This is the code I used to create the object, from the file "Neighborhoods.java".
public class Neighborhoods {
// variables
String name;
int vertices;
double[] latCoords;
double[] longCoords;
public Neighborhoods() {
Neighborhoods fisherHill = new Neighborhoods();
fisherHill.name = "Fisher Hill";
fisherHill.vertices = 4;
fisherHill.latCoords = new double[] {42.331672, 42.326342, 42.334464, 42.335733};
fisherHill.longCoords = new double[] {-71.131277, -71.143036, -71.148615, -71.141062};
}
}
I then tried to use the object I created, "fisherHill" (from the class Neighborhoods) in my main class when calling a function from another different class (called "inPolygon").
inPolygon.check(Neighborhoods.fisherHill.vertices);
But for some reason, I'm getting an error when I try to reference the fisherHill object, as it says it can't be found.
I know I'm making some dumb mistake here, but I'm not sure what it is. Sorry if I used the wrong terminology in describing the code. Any help or suggestions would be much appreciated.