Java Enum finalize() MethodThe finalize() method of Enum class doesn't exist. SyntaxOverrideThe finalize() method of Enum class overrides the finalize() method of class Object. Example 1Test it NowOutput: Error:(14, 26) java: enums cannot have finalize methods In the above example, it's proved that enum class cannot have finalize() method. Example 2Test it NowOutput: Colour list: red brown green pink
Next TopicJava Enum
|