Important Java Mcq 1

The fields in an interface are implicitly specified as?

a. static only

b. protected

c. private

d. both static and final

Answer:

d. both static and final

Explanation

Fields in an interface are by default static and final. Static because they belong to the interface. Final because any implementation can change the value of fields.
Then they would become a part of the implementation, an interface is a pure specification
without any implementation.

Related MCQs
Aniket Malik

Aniket Malik

CERTIFIED TUTOR/TRAINER WITH 300+ REVIEWS

Facing difficulty with

this concept?