You can NEVER invoke an enum constructor directly. The enum constructor
is invoked automatically, with the arguments you define after the constant
value.
you are invoking constructor by creating instance Coffee c=Coffee.BIG;
Even this program
will result in a similar output:
You can NOT call an enum constructor directly. So in my main method I can't addThis will result in a compiler error.
My no-arg constructor invokes without any problem a call to the 1-arg constructor with this("A"), so that's no problem. Which constructor will be invoked is defined by your set of constants you are declaring. From my example: