Below is a detailed explanation of how this works: The program is quite simple and straightforward. This service(programmatic method/function) to find whether there’s a departmental vacancy can be provided by the Department class which the Professor class can access.Įxample program to illustrate one-to-many Association between Department class and Professor class in Java: For example, A professor who is trying to enroll in a department can be able to verify whether a department he wants to join has a vacancy. Functionality/Services of one object can be accessible to another object.And a department object can be able to access/know the names/details of all the professors that work in it. For example, A professor entity modeled as an object would be able to access/know the names of all the departments he works at. So one object will be able to access the data of another object. These associations in java help the objects of one class to communicate with the objects of the other class. This is the many-to-many association between the two classes. Multiple professors can be assigned to work in multiple departments.This forms a many-to-one association between the two classes.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |