Do not use
int to hold dates. An
int is an integer number, it's not suitable to hold a date.
Do you realize what happens in these lines?
leela krishhna wrote:
You are computing 23 divided by 1 divided by 2012, with integer division. The result of that computation will be 0. So you're passing the value 0 for the date to the constructor of class Computer. All three Computer objects with have their date set to 0.
Use class java.util.Date to hold a date, not
int.
Also: The member variable
id (line 14) should not be
static. (Why did you make it
static?).