If a method in an interface is declared without an access modifier, it is implicitly ________.
- package-private (no modifier)
- private
- protected
- public
In Java, if a method in an interface is declared without an access modifier, it is implicitly considered public. This means that the method is accessible from any class that implements the interface, even if it is in a different package. The other access modifiers (private, protected, and package-private) cannot be used for interface methods.
Loading...
Related Quiz
- If you are working on a highly concurrent system that uses many synchronized methods, and you notice that the application is facing performance issues, how might you optimize the application while maintaining thread safety?
- The ________ method of Connection interface sets the changes made since the previous commit/rollback permanent.
- The ________ interface of the JDBC API provides cursor support, which allows forward and backward navigation through the result set.
- The ________ method of the String class returns the index within this string of the first occurrence of the specified character, starting the search at the specified index.
- Which of the following functional interfaces in Java utilizes Lambda expressions?