Computer Science, asked by mamtaguleria3874, 1 year ago

Can a class in Java be both final and abstract?

Answers

Answered by veerukhugar
3

Hey mate

Ans:--NO,

You cannot make an abstract class or method final in Java because abstract and final are the mutual exclusive concept.

*An abstract class is incomplete and can only be instantiated by extending a concrete class and implementing all abstract methods, while a final class is considered as complete and cannot be extended further.

*This means when you make an abstract class final, it cannot be extended hence it cannot be used and that's why Java compiler throws a compile time error when you try to make an abstract class final in Java.

* In short, an abstract class cannot be final in Java, using both abstract and final modifier with a class is illegal in Java.

I hope this will helps you

mark my ans as brainliest

Answered by Ritikalakrabairagi
1
No we cannot a class in java be both final and abstract.

hope it helpful
✨✨✨✨✨
Similar questions