Which of the following are legal entry point methods that can be run - ProProfs Discuss
Advertisement

Which of the following are legal entry point methods that can be run from the command line?

Which of the following are legal entry point methods that can be run from the command line?

Change Image    Delete

Private static void main(String[] args), Public static final main(String[] args), Public void main(String[] args), Public static void test(String[] args), Public static void main(String[] args), or Public static main(String[] args)

Asked by Alexpoiry, Last updated: Nov 29, 2024

+ Answer
Request
Question menu
Vote up Vote down

4 Answers

K. Gibson

K. Gibson

Get immense pleasure in traveling and writing about visiting places.

K. Gibson
K. Gibson, Corporate employee, MA, Gloucester

Answered Sep 24, 2020

The only legal entry point method that can be run from the command line is the "Public static void main (String[] args). The first option there would have been correct, but it has to be a public static void main and not private static void main.

The second and sixth options, which are "public static final main(String[] args)" and "Public static main(String[] args) respectively, are also not correct because there must be a void return type for the main() method. The third option, which is "public void main(String[] args)," is also not correct because the main() method has to be static.

The fourth option, which is "public static void test(String[] args)" is not correct also, simply because the main() method has to be named main. Moreover, Java is very case sensitive. Therefore, make sure you type in your entry correctly, such as "public static void main(String[] args).

upvote downvote
Reply 

L. Sevigny

L. Sevigny

L. Sevigny
L. Sevigny, Doctor, Las Vegas

Answered Oct 24, 2018

It might seem in the beginning that noneof the above is the best option but if you would look at it closely, you will realize that it is not the lowercase public that was used for this. The best answer is none of the above. Do remember that Java is case sensitive.

The type of case that you will use will surely have an effect on whether it will work or not. If you believe that it will not work, then you can find other options available.

upvote downvote
Reply 

mohideen87

mohideen

mohideen87

7. None of the above.

Java is case sensitive.

upvote downvote
Reply 

John Smith

John Smith

John Smith
John Smith

Answered Oct 04, 2016

Public static void main(String[] args)

E. Option E is the canonical main() method signature. You need to memorize it. Option A is incorrect because the main() method must be public. Options B and F are incorrect because the main() method must have a void return type. Option C is incorrect because the main() method must be static. Option D is incorrect because the main() method must be named main.
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.