I'm a beginner in Java and I wanted to ask a question:
Is that possible to clone implemented abstract method body?
Example:
public abstract class ClassA{
public abstract void method();
}
ClassA objA = new ClassA(){
public void method(){
System.out.println("Yay");
}
}
//creating objB with the same method as in objA
objB.method();
Output: Yay
Yes, you can.
Just implement
Cloneableinterface toClassAclass.Then you can do this.