Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

a question in fixing this code

 
alex lotel
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i noticed that A doesnt implement C
it doesnt have print method
i tried to fix it by adding

public class A extends B implements C

but it ssays that there is a bug in the superconstructor
i cant understand what is the bug??

 
alex lotel
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i was told that another way is to write abstract on class A

but i cant understand it meening

because abstract is just an interface with the possibility
of including a finish method not just the signatures like
interface

??
 
S Reddy
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are implementing an interface, you should define body for every method in the interface. If you don't want want to do it in the class 'A', declare it as abstract, so that 'A' don't need to implement it but any subclass of 'A' should implement it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic