Java OCA OCP Practice Question 1409

Question

Which of the following are valid declarations?

Select 1 option

A. abstract int m (int param) throws Exception; 
B. abstract native int m (int param) throws Exception; 
C.  float native getVariance () throws Exception; 
D. abstract private int m (int param) throws Exception; 
E. strictfp float f; 


Correct Option is  : A

Note

P:For Option B.

native method cannot be abstract.

For Option C.

return type should always be on the immediate left of method name.

For Option D.

private method cannot be abstract.

A private method is not inherited so how can a subclass implement it?

For Option E.

The keyword strictfp can only be applied to class or method declarations.




PreviousNext

Related