Can you declare abstract class final
Answer: No the class can be either abstract or final, not both.
Let’s think why somebody asked this questions what was in his mind or just he was testing java knowledge?
Look below if somebody want to do this:
Solution 1: Create final class with private constructor means no class instantiate it and it can’t be sub-classed. ( Singleton design pattern indeed)
Solution 2: You can’t get much simpler than using an enum with no instances.
enum class is final, with explicitly no instances.
This is detected by the compiler rather than as a runtime error. (like throwing an exception)