What is ENUM?

Answer Posted / javamasque

1. Enum is implicitly final subclass of java.lang.Enum.
2. if an enum is a member of a class, it is implicitly static.
3. The keyword “new” can never be used with an enum, even within the enum type itself.
4. For enum constants, “equals” and “==” is same thing, and can be used interchangeably.
5. Enum constants are implicitly public static final.
6. The enum constants are its instances.
7. Only private modifier can be used before it’s constructor.
8. Enum can implement interface but can’t extends any class
9. We can override only toString() method to return any custom string.
10. The static method values() return all enum constants in an order as it found inside enum class.
11. The instance method name() returns string value of enum constant.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is Global Assembly Cache (GAC) and what is the purpose of it? (How to make an assembly to public? Steps) How more than one version of an assembly can keep in same place?

571


What will be the output of the following code?

514


Is it possible to have different access modifiers on the get/set methods of a property?

519


What is datatable in c#?

492


Can structs in c# have destructors?

550






Can bool be null c#?

503


Which attribute adorn a test class to be picked up by the NUnit GUI in the NUnit test framework?

556


What is difference between property and variable in c#?

471


What is the purpose of the integer parse method the decimal parse method?

526


Explain how can I get around scope problems in a try/catch?

488


Why main method is static in c#?

498


How big is an int in c#?

516


What are object pooling and connection pooling and difference between them?

518


What are the collections in c#?

478


What is c# used for?

515