Constructors.
The constructors are special methods with special declarations.
So constructor declarations don't state a return type and their name matches the class name.
So for example, here, let's create an constructor of this class, my date and time to my my date and
time.
And this is our constructor and assign it here.
Here.
2019.
Here and let's.
Delete of your code.
Here my data and my data and time clock.
Here.
And print this clock here.
So as you remember, we didn't we won't assign anything on clock and you will see what happens then.
So let's print the our clock here, as you can see here.
So.
Time is here and the or no time.
This is a year.
Year is.
Here and then we will pass clock dot get here method.
So.
Here.
So the new constructor here, as you can see here, the new constructor.
Yeah, the new constructor here takes a single year, takes a single year as a parameter.
So actually, let me write the parameter here.
Integer year in and we will assign this year in or if set year.
Is here in.
Then here equals to 2019.
So.
And as you can see, we need to machine constructor initialization.
So we need to add something add year variable in it because the constructors need a parameter here.
So.
For example, 2020.
Here and we can as you can see, we don't have any errors in the code.
So here takes a single year in argument of type integer here.
So you call the set year.
Here set here with here in.
So if set here returns false the color provided by input and you override here in with a default value
of 2019.
So in main here you make a clock within a new constructor and then print the result.
So the conjugation of the my date and time clock here, 2000 2020 is called an initialization.
Here.
So you might not like the idea that invalid here that in instances where slight silently corrected to
2019, I don't like it either.
So exceptions solve this problem so you will learn about them in next lectures about exceptions here.