Java Shapes | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Java Shapes

Is it possible to solve the Shapes project by using enum?

30th Jun 2022, 5:01 PM
Amichai Mizrachi
Amichai Mizrachi - avatar
3 Answers
+ 2
I don't really see what you can do with enums in this exercise. Enums allow you to create constants, often used as an attribute of an entity, it cannot take a value other than that defined in the enum. We also use enums in the database, which will make it possible to store entities with the same constraints. In the exercise, the values will change depending on the context. we can't use constants
1st Jul 2022, 5:29 AM
Roland
Roland - avatar
+ 1
You can practice the Factory pattern with enums in this exercise 😉 https://code.sololearn.com/cVynQQlrrl8u/?ref=app Decorator pattern is possible too
1st Jul 2022, 6:06 AM
Roland
Roland - avatar
- 1
Have you tried?
30th Jun 2022, 5:14 PM
Justice
Justice - avatar