I've looked around and tried to solve this issue by recompiling my other classes etc but nothing seems to work.
I have two files, in SensorDataDisplay.java I have the following code:
private SensorSim[] sensors;
...
public void runSimulation(double numberOfSensors) {
sensors = new SensorSim[numOfSensors];
int i = 0;
for(i = 0; i<numOfSensors; i++) {
sensors[i].SensorSim(sensorNom, sensorErr);
}
}
And then in the same directory I have SensorSim.java compiled into SensorSim.class, the constructor is below.
public SensorSim(double n, double d) {
if (probs == null)
loadData();
nominal = n; sd = d;
rng = new Random();
running = true;
}
This was working when I was just creating a single sensorSim. I recently added the array of sensorSims which is when I got this error:
$ javac SensorDataDisplay.java
SensorDataDisplay.java:44: cannot find symbol
symbol : method SensorSim(double,double)
location: class SensorSim
sensors[i].SensorSim(sensorNom, sensorErr);
^
1 error
Looking around I saw that it may have to do with older class files so I removed and recompiled the other files (SensorSim.class). Another possible reason that i read was to do with scope but it looks okay to me, i'm new to Java however. Why might this error may be occurring?