Java OCA OCP Practice Question 947

Question

Which of the following compile? (Choose all that apply)

  • A. final static void method4() { }
  • B. public final int void method() { }
  • C. private void int method() { }
  • D. static final void method3() { }
  • E. void final method() {}
  • F. void public method() { }


A, D.

Note

Options A and D are correct because the optional specifiers are allowed in any order.

Options B and C are incorrect because they each have two return types.

Options E and F are incorrect because the return type is before the optional specifier and access modifier, respectively.




PreviousNext

Related