I know that multiple inheritance is not supported in java. I wrote the code as shown below.
abstract class abc {
public abstract void print();
}
abstract class xyz {
public abstract void print();
}
public class Test {
public static void main(String[] args) {
abc obj1 = new abc() {
public void print() {
System.out.println("abc");
}
};
xyz obj2 = new xyz() {
public void print() {
System.out.println("xyz");
}
};
obj1.print();
obj2.print();
}
}
The output produced is:
abc
xyz
My question is, here I am using two abstract classes with a concrete class. Isn't that an implementation of multiple inheritance? And I intend to implement the code using classes, not interfaces.