Câu hỏi phỏng vấn Java
Câu hỏi

Can an enum be extended?

Câu trả lời

No, an enum cannot be extended in Java. Enums are final by design, which means they cannot inherit from another class. In Java, all enums implicitly extend the java.lang.Enum class, and since Java does not support multiple inheritance for classes, an enum cannot extend any other class[1][3][5][6].

Citations:
[1] https://www.java67.com/2013/07/15-java-enum-interview-questions-amswers-for-experienced-programmers.html?m=1
[2] https://www.mockquesti...

middle

middle

Gợi ý câu hỏi phỏng vấn

middle

Can you access non static variable in static context?

senior

What is the difference between Applets loaded over the internet and Applets loaded via the file system?

junior

How does Garbage Collection prevent a Java application from going out of memory?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào