Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

Is it possible to execute a program without defining a main() method?

Pragya Keshap answered on February 4, 2023 Popularity 3/10 Helpfulness 1/10

Contents


More Related Answers

  • run program without main method using macro
  • can i call another function from main hava
  • Can we create a program without main method?

  • Is it possible to execute a program without defining a main() method?

    0

    No, with Java 7 onwards, you need a main() method to execute a

    program. 

    In earlier versions of Java, there was a workaround

    available to use static blocks for execution.

     But now this gap has been closed

    https://www.tutorialspoint.com/can-we-execute-a-java-program-without-a-main-method#:~:text=Yes%2C%20we%20can%20execute%20a,by%20using%20a%20static%20block.

    Popularity 3/10 Helpfulness 1/10 Language java
    Source: Grepper
    Tags: execute java
    Link to this answer
    Share Copy Link
    Contributed on Feb 04 2023
    Pragya Keshap
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.