Submit Your Site To The Web's Top 50 Search Engines for Free! Java Tutorial: Learn Java Basics For Free | Learn Java

Saturday, December 14, 2019

HAS-A relationship in Java - Learn java

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

Java Inheritance Update 2023 With Program And Example

  Java Inheritance Update 2023 With Program And Example  nheritance is one of the essential concepts in object-orientated programming  (OOP)...