GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  J2EE  >  Core Java

 Print  |  
Question:  why java does not support inheritance of multiple superclasses?
what is achieved by inheritance?
why there is no main method in servlets/jsps?




November 11, 2005 16:19:29 #5
 Mandar Arun Joshi J2EE Expert  Member Since: November 2005    Total Comments: 20 

RE: why java does not support inheritance of multiple ...
 

A1.

Consider following example

class A { method XYZ(//some implementation)}

class B { method XYZ(//some implementation)}

class C extends A,B

Now if you say C c = new C() and C.XYZ() java don't undestand which implementation to use.

A2.

Inheritance achieves structure, reusable code

A3.

main() method is required to start new java process. In servlet,JSP (which are just class not process) container is responsible for life cycle of both. Container itself is part of some running process.

     

 

Back To Question