Constructors are used to initializing the variables. Following example helps in better understanding.
Code:public class Lab {
private int id;
private String name;
private String category;
private Date dateOfConst;
public Lab(int id, String name, String category, Date dateOfConst)
{
this.id = id;
this.name = name;
this.category = category;
this.dateOfConst = dateOfConst;
}
}
