Skip to main content

Inheritance in the Interfaces

                                 inheritance in interfaces



Inheritance in the Interfaces:

            interface A
            {
                        void m1();
            }
            interface B extends A
            {
                        void m2();
            }
            class C implements B
            {
                        public void m1()
                        {
                                    System.out.println("Method M1");
                        }
                        public void m2()
                        {
                                    System.out.println("Method M2");
                        }
            }
            class InterDemo2
            {
                        public static void main(String args[ ])
                        {
                                    C ob=new C();
                                   
                                    ob.m1();

                                    ob.m2();
                        }
            }


Comments