Yashwantrao Raut wrote:I have seen that post but not able to create singleton using it.
anyone know to create it.my code is not working .i will post their.
1. Which code is not working? Please post the code if its not same as the one posted earlier.
2. What is the error you are getting?
From the post linked by Charles
https://coderanch.com/t/642527/java/java/Enum-Singleton it shows clearly how to create singleton using enum.
Update:
The code posted by you in the first post doesn't work because it is not a valid Enum syntax and not a valid way to use Enum. You can learn about Enums
here