Question: I'm asked to write an expiry method for a policy that expires in exactly one year after it's added. I already wrote the method that adds one year to the initial date it was added.

Now I'm trying to write another method that returns a boolean to see if Date A is past Date B. If it's past, it means it's expired, so it'll return true. Can someone help me out with the Syntax, not sure what to do here. Thank you

```
public ExpirablePolicy(float a, Date d){
    super(a);
    amount = a;
    expiryDate = new Date();
    GregorianCalendar aCalendar = new GregorianCalendar();
    aCalendar.add(Calendar.YEAR,1);
    expiryDate = aCalendar.getTime();
} 

public boolean isExpired(){
    //expiry method;

```

Answer: 
This can be done with [`Date.before()`](http://docs.oracle.com/javase/7/docs/api/java/util/Date.html#before%28java.util.Date%29) or [`Date.after()`](http://docs.oracle.com/javase/7/docs/api/java/util/Date.html#after%28java.util.Date%29):

```
if (d.after(expiryDate)) { ... }

```

or

```
if (!d.before(expiryDate)) { ... }

```

The first comparison evaluates to `true` is `d` is strictly greater than `expiryDate`. The second evaluates to `true` if `d` is greater than or equal to `expiryDate`.

The same effect can be achieved with [`Date.compareTo()`](http://docs.oracle.com/javase/7/docs/api/java/util/Date.html#compareTo%28java.util.Date%29).
try this:

```
public boolean isExpired(Date a, Date b) {
    return a.before(b);
}

```