• Post Reply Bookmark Topic Watch Topic
  • New Topic

Confusion regarding multiple inheritance  RSS feed

 
Gautam Bhalla
Ranch Hand
Posts: 30
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator














Now I have 3 questions out of this code-::


1) why my java compiler is not permitting me to write implements before extends?


2) I have not given definition of disp() method of my interface but implemented the same method in class Cls as public method..It is giving compile time error like disp was not defined in ClsMain.Even though its definition has to be found as it is inherited from Cls by ClsMain?

3) Is it an example of multiple inheritance by classes in java?


 
drac yang
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
before extends, you must implement the method declared in the interface which ClsMain implemented, after extends, ClsMain has already got the corresponding implemention.
 
Ivan Jozsef Balazs
Rancher
Posts: 999
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> why my java compiler is not permitting me to write implements before extends?

Because it is enforcing the language rule dictating the order.

Java Lang Spec Chapter 8. Classes

ClassDeclaration:
NormalClassDeclaration
EnumDeclaration

NormalClassDeclaration:
ClassModifiersopt class Identifier TypeParametersopt
Superopt Interfacesopt ClassBody

 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!