I’m trying to create a list of float values, but it seems it’s not right this way :
EDIT:
public Supervisory() {
this.analogs = new ArrayList<Float>();
}
public void active() {
try {
for (ObjectIdentifier oi : ois) {
if (oi.getObjectType().intValue() == 2){
analogs.add(new Float(10));
}
}
} catch (IOException ioe) {
throw new RuntimeException(ioe.getMessage());
} catch (Exception ex) {
throw new RuntimeException(ex.getMessage());
}
}
My last code it was just a snippet to give the idea of my problem.
What’s wrong with this implementation ?
You need to put your code inside a method, it cannot just float around in the class:
Or in a constructor: