nerdexam
Oracle

1Z0-808 · Question #70

public static void main(String[] args) { System.out.println("three"); } void mina(Object[] args) { System.out.println("four"); } What is printed out when the program is executed?

The correct answer is C. three. Option C is correct because Java's entry point requires an exact signature: public static void main(String[] args) - the first method matches this precisely, so the JVM calls it and prints "three". The second method, mina, is never invoked by the JVM or anywhere in the code, so…

Working with Methods and Encapsulation

Question

public static void main(String[] args) { System.out.println("three"); } void mina(Object[] args) { System.out.println("four"); } What is printed out when the program is executed?

Options

  • Aone
  • Btwo
  • Cthree
  • Dfour

How the community answered

(18 responses)
  • A
    6% (1)
  • B
    6% (1)
  • C
    89% (16)

Explanation

Option C is correct because Java's entry point requires an exact signature: public static void main(String[] args) - the first method matches this precisely, so the JVM calls it and prints "three". The second method, mina, is never invoked by the JVM or anywhere in the code, so "four" is never printed. Options A ("one") and B ("two") are pure distractors - those strings don't appear anywhere in the code at all. The subtle trap here is that mina looks like main at a glance, but it has two disqualifying differences: the method name is misspelled and it takes Object[] instead of String[].

Memory tip: Think "PSSM" - the JVM entry point must be Public, Static, Void, named main, with a String[] parameter. Any deviation and the JVM ignores it entirely.

Topics

#main method entry point#method invocation#method signatures#program execution

Community Discussion

No community discussion yet for this question.

Full 1Z0-808 Practice