How can you run a Java program without main method? - ProProfs Discuss
Advertisement

How can you run a Java program without main method?

Asked by , Last updated: Apr 11, 2024

+ Answer
Request
Question menu
Vote up Vote down

2 Answers

B. Mary

B. Mary

Health comes first, and I happen to know a lot about health.

B. Mary
B. Mary, Health Care manager, MHA(Master's In Healthcare Administration), Raleigh, North Carolina

Answered Dec 02, 2019

Many teachers of the Java programming language teach otherwise, but it is possible for a Java program to run without the main method. To do so, one would need a static block.

Once one has the block, they would use a code that can be executed and put it in the block. Once in the block, it can then be executed. While this is an option, if one is needed to run the program from their command-line without the static block, the main ()method will be required. The reason for this is because the Java Machine will continue looking for the main ().

upvote downvote
Reply 

Mudda Prince

Mudda Prince

Mudda Prince
Mudda Prince

Answered Aug 21, 2019

Java is actually a foundation for all kinds of networked applications, not only that this is the global standard for developing embedded and mobile applications, web application, online games, Web-based content, and organizational software. With over 9 million developers in all over the world, Java enables the users to efficiently as well as perfectly develop a new application, and also it helps to deploy and use the exciting applications and services. If you are interested just go through this Use Java in Web Technology

upvote downvote
Reply 

Advertisement
Advertisement
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader

Email Sent
We have sent an email to your address "" with instructions to reset your password.