[英]Set one kind of enum to another enum kind of enum in java
It would be better if you declare enum Type<\/code> out of
Entity<\/code> or
Response<\/code> class.
如果您将
enum Type<\/code>声明为
Entity<\/code>或
Response<\/code>类会更好。
Then you could use same enum for both classes.
然后你可以对两个类使用相同的枚举。
You can declare an enum at any of three levels:您可以在三个级别中的任何一个级别声明枚举:
Separate class单独的班级<\/li>
Nested within a class嵌套在一个类中<\/li>
Locally ( in Java 16+<\/a> )本地(
在 Java 16+ 中<\/a>)<\/li><\/ul> For your situation, I suggest you use the first rather than the second.
对于您的情况,我建议您使用第一个而不是第二个。
"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.