I'm trying to add every task which has been created in constructor
static private int Id = 0;
private int id = 0;
private Date StartDate;
private Date EndDate;
private static ArrayList<Task> Tasks;
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
public Task(java.util.Date StartDate, java.util.Date EndDate) {
try{
this.setStartDate(StartDate);
this.setEndDate(EndDate);
setId(Id++);
System.out.println(this.id + this.EndDate.toString() + this.StartDate.toString());
Tasks.add(this);
}
catch(Exception ex){
System.out.println(ex);
}
}
It throws NullPointException.
I couldn't find out a way to solve this.
Thanks in advance!