Hi,
I've seen what looks to be a little bit of confusion on what access modifiers can be used for the entry-point main() method in an application.
Obviously, if placed individually in a file, any of these will
compile fine:
public static void main(
String[] args) {...}
static void main(String[] args) {...}
protected static void main(String[] args) {...}
private static void main(String[] args) {...}
because they can just be considered normal methods. The question is whether they are legal entry point into an application.
In compiling and running examples of each, I've seen that any of those 4 main() methods
will work as an entry point. However, I've also seen comments that this behavior is a bug, and that officially they are not supposed to work (except for "public", of course), and thus, should be considered wrong on the Exam.
Does anyone know for sure how it should be answered on the
test?
Thanks in advance,
Dave