Hi
In this program i tried implements,inhe ritance (I tried multiple inheritance in C++).
In C++ I knew that multiple inheritance means we can invoke all classes and class functions from derived class itself with an object...
I tied that same idea in Java , but in java it is a flop to me...
I tried inheritance using implements and interface in java...
If anybody having any idea or know how can repair this code please tell me...
Now also i think that i can directly call outer class methods from derived class of java with an object...
In this program i tried implements,inhe ritance (I tried multiple inheritance in C++).
In C++ I knew that multiple inheritance means we can invoke all classes and class functions from derived class itself with an object...
I tied that same idea in Java , but in java it is a flop to me...
I tried inheritance using implements and interface in java...
If anybody having any idea or know how can repair this code please tell me...
Now also i think that i can directly call outer class methods from derived class of java with an object...
Code:
class class1
{
public class1()
{
System.out.println("Class 1");
}
}
interface class2
{
public void class2();
public void class3();
}
class class3 implements class2
{
public class3()
{
System.out.println("Class 3");
}
public void class2()
{
System.out.println("Class 2");
}
}
class class4 extends class1 implements class2
{
public class4()
{
System.out.println("Class 4");
}
public void class2()
{
System.out.println("Class 2");
}
public static void main(String args[])
{
class4 c1=new class4();
c1.class2();
c1.class3();
}
}
Comment