I have two classes, `Employee` and `Department`.

`Department` is subclass of `Employee`.

The code is below:

```
public class Employee {
    public void getEmployeeDetails(String name , String age) {
        System.out.println("Employee.getEmployeeDetails()");
    }

    public void print() {
        System.out.println("Employee.print()");
    }
}

public class Department extends Employee {
    public void getEmployeeDetails(String name , int age) {
        System.out.println("Department.getEmployeeDetails()");
    }

    public void print() {
        System.out.println("Department.print()");
    }
}

```

I am running following code.

```
 public static void main(String[] args) {
        Employee e1 = new Department();
        e1.getEmployeeDetails("Manish", "10");
        e1.print();
    }

```

The output is 

```
Employee.getEmployeeDetails()

Department.print()

```

When I run the `getEmployeeDetails()` method the JVM is calls the parent class, but when I call the `print()` method the JVM calls the child class.

Why is this happening this way?