1

How I should make something like that in Java?

UML Diagram

Right now I've this:

public class Person {
    String name;
    String surName;
    Integer yearOfBirth;

    //Constructors, Getters, Setters and Methods
}

public class Professor extends Person {
    String department;
   
    //Constructors, Getters, Setters and Methods
}

// Two Childs of Professor

public class DepartmentProfessor {
    String departmentName;

    //Constructors, Getters, Setters and Methods
}

I'm very newbie to UML, if I understood correctly, Professor has to be an interface and DepartmentProfessors have to implement it but then I've the problem of Person being superclass, have concrete methods, of Professor and it having two subclasses.

1 Answer 1

2

You are mistaken. Professor is a simple class and DepartmentedProfessors the same. Only that the latter depends on the first one (the dashed arrow line). This is because Professor is used in a paramter of the operation addProfessor(Professor).

Sign up to request clarification or add additional context in comments.

1 Comment

So, DepartmentProfessor ----> Professor is just because of the operation addProfessor(Professor) no relationship between them of implement or extend?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.