Knowee
Questions
Features
Study Tools

Is the below statement correct? private static void main(String args[]) { }

Question

Is the below statement correct? private static void main(String args[]) { }

🧐 Not the exact question you are looking for?Go ask a question

Solution

No, the statement is not correct. In Java, the main method must be public, not private. The correct statement is:

public static void main(String[] args) { }

Similar Questions

String args[] in main method are used for?public static void main (String args[]){//}A. Passing arguments at compile time B. Passing arguments at run timeC. Counting number of words D. To hide the main method from misuseE. To call the main method outside of Class F. None of the above

Which of the following is the correct header of the main method? Please select all that apply. Group of answer choicespublic static void main(String[] args)public static void main(String args[])public static void main(String[] x)public static void main(String x[])static void main(String[] args)

In Java, what is the role of the public static void main(String[] args) method? a. Initialization method b. Execution entry point c. Constructor d. Destructor

What is the purpose of the "public static void main(String[] args)" method in a Java program?*1 pointIt is used to print debugging information.It is a reserved method name for future use.It defines a class constructor.It is the entry point of the program.

public class Test {    public void  m1(String arg1)  {        arg1="Test";    } public static void main(String[] args) {        Test test1= new Test();        String s= "Hello";        test1.m1(s);        System.out.println(s);  }}

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.