hi in C++ we can have enum of follwoing type:
enum e_acomany { Audi=4, BMW=5, Cadillac=11, Ford=44, Jaguar=45, Lexus, Maybach=55, RollsRoyce=65, Saab=111 };
can we have the similar enum in java. This question might seems childish but i am new to java enum please give me the answer and also provide some links to example.
You can define enum values with associated numbers:
You can then write your own method to convert an
idto aCompanyvalue. But fundamentally enums are pretty different in Java to C++, and you may well not want to use them in exactly the same situations.