Computer Science, asked by kishansavani, 2 days ago

Can I run a java program without main() method?
if yes then how?

Answers

Answered by Lalitakumari2509
1

Answer:

Yes You can compile and execute without main method By using static block. But after static block executed (printed) you will get an error saying no main method found.

...

Yes, sequence is as follows:

  • jvm loads class.
  • executes static blocks.
  • looks for main method and invokes it.

Explanation:

please mark me as brainliest

Similar questions