What are the valid signatures for the main method?
The only valid one I know of is:
public static void main(
String variable []) and
"static" is required". Also, by default main is final.
However, I tried the below with protected, private, and friendly, and I am not getting an error. Also, could you let me know if any of my assumptions are wrong or incomplete.
<CODE>
public class Parent {
final void zzz() {
System.out.println("zzz6");
}
void main(String args []) { //errored must have static
//static void main(String args []) { //no errors on below sign.
//final static void main(String args []) {
//final private static void main(String args []) {
//private static void main(String args [])
//protected static void main(String args [])
//static void main(String args [])
new Parent().zzz();
}
}
</CODE>