HAS-A relationship in Java - Learn java
1.HAS-A Relationship is also knows as composition(or) aggregation.
2.There is no specific keyword to implement HAS-A relationship but mostly
we can use new operator.
3.The main advantage of reusability.
Example:-
class Engine{
// engine functionality
}
class Car
{
Engine e=new Engine();
//------------------------------;
//------------------------------;
//------------------------------;
}
NOTE:-
class car has-a engine reference.The main dis-advantage of has-a relationship increases dependency between the
components and creates maintains problems.
Learn Java online free and learn java programming this is the
best way to learn java. this is best java tutorial.in this tutorial
all the programs start with hello java,hello world.Enterprise applications
programming language
No comments:
Post a Comment