The interface in Java is a mechanism to achieve abstraction. It has static constants and abstract methods. Private, public, or package-private may only be a nesting class. An interface in Java is a blueprint of a class. The Class Object, 9.8 Functional Interfaces, 9.4.3 Interface Method Body, 9.6.4. Below are some rules to control the visibility: A top-level class (a class whose name is the same as the Java source file that contains it) can also be either a public or a private package (without an access modifier) and cannot be a private one. In any interface, the methods declared are public by default. Since: 1.8 See The Java™ Language Specification: 4.3.2. This rule is the very basic one that every developer must know. Regardless of whether or not a FunctionalInterfaceĪnnotation is present on the interface declaration. However, the compiler will treat any interface meeting theĭefinition of a functional interface as a functional interface
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |