An interface which is declared inside a class or another interface is called a nested interface or a member interface. A nested interface can be declared as public, private or protected. Let’s look at an example of how to create and use a nested interface: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 class A { int x; public interface IA { void method(); } } class B implements A.IA { public void method() { System.out.println(“Method implemented successfully”); } } public class Driver { public static void main(String args)
The post How to work with nested interfaces in java programming appeared first on Coding Security.
How to work with nested interfaces in java programming
read more
Tidak ada komentar:
Posting Komentar