I use the following code and got an error while calculation a value inside enum:
enum elPosition {
p1(
(boxX*0 + boxX/2),
(boxY*0 + boxY/2)
),
p2(
(boxX*1 + boxX/2),
(boxY*1 + boxY/2)
),
p3(
(boxX*2 + boxX/2),
(boxY*2 + boxY/2)
);
private double xPosition;
private double yPosition;
elPosition(final double xPosition, final double yPosition) {
this.xPosition = xPosition;
this.yPosition = yPosition;
}
private static final double boxX = 10;
private static final double boxY = 10;
public double getXPosition() {
return xPosition;
}
public double getYPosition() {
return yPosition;
}
}
If instead of calculation some value is used, no error occurs.