Java OCA OCP Practice Question 1722

Question

Which one of these is not a legal member declaration within a class?.

Select the one correct answer.

  • (a) static int a;
  • (b) final Object[] fudge = { null };
  • (c) abstract int t;
  • (d) native void sneeze();
  • (e) final static private double PI = 3.14159265358979323846;


(c)

Note

The declaration in (c) is not legal, as variables cannot be declared abstract.

The keywords static and final are valid modifiers for both field and method declarations.

The modifiers abstract and native are valid for methods, but not for fields.




PreviousNext

Related