public double calc(double x, double y){}
coincides with
private double calc(double x,double y){}
unless you add the calc() method to the Operation enumeration. Regarding JLS:
Instance methods declared in these class bodies are may be invoked outside the enclosing enum type only if they override accessible methods in the enclosing enum type.
Basically, the type oprt is Operation , and since Operation does not have a declaration for a method called double calc(double x,double y) , you cannot call the method using oprt . In short, methods defined in class classes must be overridden by methods so that they are accessible externally.
source share