OCA Java SE 8 Mock Exam Review - OCA Mock Question 28
Question
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 void main(String );
- public static int main(String args[]);
Answer
Note
The following code shows how to use the main method.
public class Main {
public static void main(String[] args) {
int a = 1;
System.out.println(++a);
}
}