• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Confusion regarding multiple inheritance

 
Ranch Hand
Posts: 30
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?


 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 1044
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic