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: 
The only difference is that you do not have a reference to the Date object within the test method so you won't be able to do anything with it in the test method. It seems like you don't need to do anything with it except pass it to the Employee object so there's no reason not to do it. It will not effect the way the Employee object will be able to use it because the Employee object does not know or care whether the Date argument was passed from a variable or anonymously.
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));
}

```