QuesHub > Abstract > can > class > ASK DETAIL

Can an abstract class have a main method in Java?

Amelia Wilson | 2023-06-09 06:34:36 | page views:1898
I'll answer
Earn 20 gold coins for an accepted answer.20 Earn 20 gold coins for an accepted answer.
40more

Harper Patel

Studied at the University of Toronto, Lives in Toronto, Canada.
So there's no problem. Abstract just means you can't instantiate the class directly. You can have constructors if you want - they might be needed for subclasses to initiate the object state. You can have static methods, including main() and they don't need an object so calling them is fine.Feb 23, 2014
2023-06-17 06:34:36

Harper Collins

QuesHub.com delivers expert answers and knowledge to you.
So there's no problem. Abstract just means you can't instantiate the class directly. You can have constructors if you want - they might be needed for subclasses to initiate the object state. You can have static methods, including main() and they don't need an object so calling them is fine.Feb 23, 2014
ask:3,asku:1,askr:137,askz:21,askd:152,RedisW:0askR:3,askD:0 mz:hit,askU:0,askT:0askA:4