Question: I'm new to Java and just tried something that worked, but I don't completely understand it.

```
public void test(){
    Employee employee = new Employee(new Date(1,2,1990));
}

```

I'm calling the constructor of Employee and then **passing as a parameter a new Class and calling its constructor. What is this called?** I have not been able to find any information on this, and would like to understand what is actually happening here.

More detail: My first effort was to create an instance of the Date class and then pass the object as the parameter, but to save on code and memory I decided to try this instead. It works as I intended, but I would like to understand the object life cycle of this, and to know if there are any drawbacks to doing it this way?

Thank you @hfontanez! A search for **"anonymous reference"** helped me find some info on this. But there isn't much out there that explains it.

Answer: 
You are calling the constructor of 'Employee' with an instance of 'Date', while creating the instance of date means, that you are calling the constructor of 'Date' with 1,2,1990.

This would do the same (I think that's what you meant):

```
public void test() {
    // Create an instance of 'Date' by passing the arguments '1', '2' and '1990' to the constructor of 'Date'.
    Date date = new Date(1,2,1990);

    // Create an instance of 'Employee' by passing the argument 'date' to the constructor of 'Employee'.
    Employee employee = new Employee(date);
}

```

The only difference between this and your posted code is that you are not storing the created object in your code.

So you can not call it like `date.doAnything`.
This code creates a new date object and passes it as a parameter to the constructor of the Employee class. The date object is available for use later.

```
public void test(){
    Date date = new Date(1,2,1990);
    Employee employee = new Employee(Date);
}

```

This code passes an **anonymous reference** to the Date class as a parameter to the constructor of the Employee class. Therefore the date object that is created only exists for the lifetime of the constructor, and cannot be used or referenced later.

```
public void test(){
    Employee employee = new Employee(new Date(1,2,1990));
}

```