Problem with dates
ok i have a problem with a method to get the year from 2 date objects and compare them. can someone tell me where im going wrong.
publicboolean yearSame()
{
int yearSold = dateSold.get(Calendar.YEAR);
int yearBuilt = dateBuilt.get(Calendar.YEAR);
if(yearSold == yearBuilt)
{
returntrue;
}else{
returnfalse;
}
}
this the method and im gettin an error of cannot find symbol - method get(int)
here is the constructor and instance variables of this class
publicclass Houseimplements Serializable
{
// instance variables - replace the example below with your own
private String houseId;
private String address;
private Date dateBuilt;
privatedouble sellingPrice;
privateboolean isSold;
private Date dateSold;
private Buyer buyer;
/**
* Constructor for objects of class House
*/
public House(String houseId,String address,double sellingPrice,int yearBuilt,int monthBuilt,int dayBuilt )
{
this.houseId = houseId;
this.address = address;
this.sellingPrice = sellingPrice;
isSold =false;
Calendar cal =new GregorianCalendar( yearBuilt, monthBuilt - 1 ,dayBuilt);
dateBuilt = cal.getTime();
}

