java - How does TimeUnit.class enum operation work? -
how enum in timeunit api work? particularly below syntax mean?
public enum name { constant { } }
i have been following enum tutorial here, doesn't go details of above syntax. thing inside constant? anonymous class own methods? methods outside of constants? i'm confused.
in {}
"abstract" methods implemented. see body of class extends - follow example - "name". if have method in name
- let's
public string somemethod(){ throw new abstractmethoderror(); /*or default implementation.*/ }
then you'd have implement in
constant{ public string somemethod() { return "green eggs , ham"; } }
and that's done in timeunit
- defines abstract methods converting different units , elements implement conversion methods magnitude.
Comments
Post a Comment