Can I have a main method in interface?

Isabella Wilson | 2023-06-09 06:42:28 | page views:1129
I'll answer
Earn 20 gold coins for an accepted answer.20 Earn 20 gold coins for an accepted answer.
40more

Oliver Wilson

Works at the International Criminal Court, Lives in The Hague, Netherlands.
With Java-8 you can have main method defined inside the interface, Below code will work in Java-8. Yes you can overload main() method, but when you launch your class, only the public static void main(String args[]){} method will be treated as an entry point.Mar 14, 2012
2023-06-16 06:42:28

Oliver Brown

QuesHub.com delivers expert answers and knowledge to you.
With Java-8 you can have main method defined inside the interface, Below code will work in Java-8. Yes you can overload main() method, but when you launch your class, only the public static void main(String args[]){} method will be treated as an entry point.Mar 14, 2012
ask:3,asku:1,askr:137,askz:21,askd:152,RedisW:0askR:3,askD:0 mz:hit,askU:0,askT:0askA:4