How do I extend and implement same method from an abstract class and interface
Ravindra Suroju
Greenhorn
Joined: Mar 11, 2008
Posts: 14
posted
0
I have a method with same signature (arguments & return type) in an abstract class and interface. I want to extend the abstract class and implement the interface in a single class. how can I do that.... please help
Code:
interface Acceptable {
public void accept ();
}
public abstract class AbstractAccept {
public abstract void accept (); // updated the code, forgot to add abstract first time
}
public class ConcreteAccept extends AbstractAccept implements Acceptable {
//// implementation code goes here
}
Tried to implement both the methods as a same method. as below but it is throwing a NoClassDefFoundError
Code: //
public class test extends AbstractAccept implements Acceptable {
public void accept(){
System.out.println("running Successfully");
}
public static void main (String[] args) {
(new test()).accept();
}
}
Please UseCodeTags. Unformatted code/config/etc. is difficult to read. You can edit your post to include them using the button or re-post the question with proper formatting.