ABSTRACT CLASS AND INTERFACE INHERITANCE
ABSTRACT CLASS AND INTERFACE INHERITANCE
interface IF1{ void m1(); void m2();}
interface IF2{ void m3();}
abstract class AC1
{
abstract void m4();
public void m5()
{
System.out.println("THIS is method 5 in abstract class");
}
}
class Test1 extends AC1 implements IF1
{
public void m1() { System.out.println("THIS is method 1 in Test1 class"); }
public void m2() { System.out.println("THIS is method 2 in Test1 class"); }
public void m4() { System.out.println("THIS is method 4 in Test1 class"); }
}
class Test2 extends Test1 implements IF2
{
public void m3()
{
System.out.println("THIS is method 3 in Test2 class");
}
public void m6()
{
System.out.println("THIS is method 6 in Test2 class");
}
}
class ApplyTest
{
public static void main(String srgs[]){
Test2 ob=new Test2();
ob.m1();
ob.m2();
ob.m3();
ob.m4();
ob.m5();
ob.m6();
}}
Comments
Post a Comment