Which two class definitions fail to compile?

Which two class definitions fail to compile? (Choose two.)
A.

B.

C.

D.

E.

Download Printable PDF. VALID exam to help you PASS.

3 thoughts on “Which two class definitions fail to compile?

  1. C, E
    # javac Test.java
    Test.java:12: error: class A2 is public, should be declared in a file named A2.java
    public class A2 {
    ^
    Test.java:23: error: illegal combination of modifiers: abstract and final
    final abstract class A5 {
    ^
    2 errors

    1
    11
  2. Answer D, E:

    (D): Final fields must be initialized immediately after declaration.
    (E): Abstract class can never be final.

    19

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.