r/learnprogramming•
[deleted]

Class integration Java.

I'm fairly new to Java, and I've got a problem that I'm not sure how to implement.

If I have a class employee with attribute "company" how is it possible to link this to the class "Company". So that from the company class I can access the employee's details.

i.e

given this:

Employee1:

Name: John

Company: Google

Employee2:

Name: Barry

Company: Google

Then in the company class, have a method that would print the list of employees:

so google.getEmployees()

Would return Barry and John.

Thanks. If this doesn't make sense just let me know.

Posted Nov 3, 2010, 1:26 PM UTC · edited

26
Loading comments…