11:50 pm - Monday March 18, 2019

IS-A HAS-A Relationship in Java

Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044

IS-A HAS-A Relationship

  • IS-A refers to inheritance or implementation.
  • IS-A is expressed with the keyword extends.
  • HAS-A means instance of a class, member variable that can 
    be accessed by an object can be expressed as has a relationship .


<pre>class Car extends Vehicle


String door;


Correct answer

a)      Car is a vehicle

b)      Vechile has a engine

c)      Car has a engine

d)       Car has a door

wrong answer

a)      vehicle is a Car 

b)      Vechile has a door

c)      vehicle has a Car 

Filed in: Core Java Tutorial

Comments are closed.