Is there any bad thing about using enum? | Sololearn: Learn to code for FREE!
+ 1

Is there any bad thing about using enum?

25th Jul 2016, 12:40 PM
Nanda Thant Sin
Nanda Thant Sin - avatar
1 Answer
No, you normally use it when you have a mode variable for a method. the only problem is that every enum is a own class and it cant extend any classes. But you can still store objects in enums: public enum SomePoints{POINT1(2,3),POINT2 (1,5); private Point point; private SomePoints(int x,int y){ this.point=new Point (x,y);} public Point get (){return point; } } To get POINT1 use Point p=SomePoints.POINT1.get (); so theres nothing wrong with using enums, its a smart way to store constants I hope that this was correct and that i could explain it understandable in my poor English Greetings
26th Jul 2016, 3:10 PM
No One
No One - avatar