t answerFrom the options given below, Choose the access specifier can be used for an interfaceOptionsPublicprivateProtectedAll of the mentioned
Question
t answerFrom the options given below, Choose the access specifier can be used for an interfaceOptionsPublicprivateProtectedAll of the mentioned
Solution
The correct answer is Public. In Java, an interface is implicitly abstract and they can only contain abstract methods. These methods are implicitly public because the purpose of an interface is to enable other types to become compatible with it. Therefore, the methods it declares are not hidden from client code, they are fully accessible, hence they are public.
Similar Questions
Select the correct answerWhich of these access specifiers can be used for an interface?OptionsProtectedPublicprivateAll of these
Select the correct answerWhich of these access specifiers must be used for main() method?Optionsprivatepublicprotectednone of the mentioned
ct the correct answerWhich of these access specifiers can be used for a class so that its members can be accessed by a different class in the different package?OptionsPublicPrivateProtectedNo Modifier
A top-level class may have which one of the following access modifiers?Optionsprivatepackageprotectedpublic
t the correct answerWhich of the following access specifiers can be used for an interface?
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.