Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3230470
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:55:51+00:00 2026-05-17T16:55:51+00:00

public static void main(String[] args) { boolean t=true; System.out.println(Before return); if(t) return; System.out.println(not execute);

  • 0
public static void main(String[] args) 
{
    boolean t=true;
    System.out.println("Before return");
    if(t) return;
    System.out.println("not execute");
}

In the above code when the return is used then it should return to the function which calls the main function. Who exactly calls the main function?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T16:55:52+00:00Added an answer on May 17, 2026 at 4:55 pm

    Java classes are executed within a larger context (a particular JVM as others have noted). Below are some possibilities:

    • you run java -cp {classpath here} com.example.foo.SomeClass to explicitly select a class for the java application launcher to run
    • you run java -jar somejar.jar (the class in question will be selected in the .jar file’s manifest)
    • you are working within Eclipse and use debug/run to execute a particular class’s main() method.

    In all cases the main() method is the canonical entry point to executing code given a particular class. From the docs on the java JVM:

    DESCRIPTION

    The java tool launches a Java application. It does this by starting a Java runtime environment, loading a specified class, and invoking that class’s main method. The method declaration must look like the following:

       public static void main(String args[])
    

    The method must be declared public and static, it must not return any value, and it must accept a String array as a parameter. By default, the first non-option argument is the name of the class to be invoked. A fully-qualified class name should be used. If the -jar option is specified, the first non-option argument is the name of a JAR archive containing class and resource files for the application, with the startup class indicated by the Main-Class manifest header.

    The Java runtime searches for the startup class, and other classes used, in three sets of locations: the bootstrap class path, the installed extensions, and the user class path.

    Non-option arguments after the class name or JAR file name are passed to the main function.

    The javaw command is identical to java, except that with javaw there is no associated console window. Use javaw when you don’t want a command prompt window to appear. The javaw launcher will, however, display a dialog box with error information if a launch fails for some reason.

    You state:

    In the above code when the return is used then it should return to the function which calls the main function.

    There may not be any other Java function (in fact there usually isn’t) which calls the main() function. It’s the convention for declaring a well-known entry point. If the JVM is launched to run your class’s main() method, then when main() returns, the JVM exits, except in a few special cases, e.g. there are other non-daemon threads running or there is a shutdown hook.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public class BooleanTest { public static void main(String[] args){ boolean b = true; if(!b){System.out.println(if);}
My program: public class m { public static void main (String[] args) { boolean
Why does this throw NullPointerException public static void main(String[] args) throws Exception { Boolean
public static void main(String[] args) { List<? extends Object> mylist = new ArrayList<Object>(); mylist.add(Java);
public class Test { public static void main(String[] args) { } } class Outer
public class doublePrecision { public static void main(String[] args) { double total = 0;
public class WrapperTest { public static void main(String[] args) { Integer i = 100;
The following code public class GenericsTest2 { public static void main(String[] args) throws Exception
Here is a quick test program: public static void main( String[] args ) {
If I make a JFrame like this public static void main(String[] args) { new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.