Ask Question
18 July, 07:58

Which of these are valid declarations for the main method?

? public void main ();

? public static void main (String args[]);

? static public void main (String);

? public static int main (String args[]);

+4
Answers (1)
  1. 18 July, 11:49
    0
    The answer is option 2. public static void main (String args[]);

    Explanation:

    The answer is public static void main (String args[]); let's understand this line:-

    public:-It is an access specifier that means whichever entity is public it will be accessible everywhere. static:-It means that there is only one copy of the method. void:-Void means that the method does not have any returning any value. main:-It is the name of the method. String args[]:-It is an array of strings which and it stores java command line arguments. User can use another name if the user want to.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Which of these are valid declarations for the main method? ? public void main (); ? public static void main (String args[]); ? static ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers