OCA Java SE 8 Method - OCA Mock Question Method 10


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

  1. final static void method4() { }
  2. public final int void method() { }
  3. private void int method() { }
  4. static final void method3() { }
  5. void final method() {}
  6. void public method() { }


A, D.


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.