Industry or Tauriel I want to talk a little bit about classes.
So first let me show you how you can open and close a project.
So in order to open a closed project you just need to double click on it and if you want to actually
close the project just to right click on your project and click on our close project OK.
As you can see this is the close project here.
OK.
So if you want to delete it you can delete.
Right click on your project and then click on it and be sure to check this option here it is.
Project contents on this if you want to completely remove your project from your system.
So first we need actually we need a job a project or the name of what project should be our classes
pre-K the project name should start with a capital letter.
OK.
I use different location and play can finish.
OK.
Now we need to create a Java class.
So in order to create a Java class when it arrives like this as our C for that or this class project
right click on it and actually knew and click on class.
OK.
So for the name of the class I prefer to type in my class.
OK.
We can use any name that you want for the modifiers to public.
And this time check this check box here that says public static void main.
This is actually going to create the main method for us.
OK.
And click can finish.
And as you can see here the main Mfat has been created automatically for us by eclipse.
So this slide here as you can see here this is a comment.
OK.
I teach you about comments later in the section.
So just delete this slide and the first thing that I want to teach you about classes is that classes
are like blueprints.
For example if I want to create a Mercedes-Benz OK I need a blueprint I need a blueprint that actually
can teach me can actually instruct me that include instructions how to create our Mercedes-Benz.
OK.
And classes are the same.
For example if I want to create a Mercedes-Benz I need a blueprint that its name is a Mercedes-Benz
as you can see I can create another class for example.
I can create files and click on File new and class.
Ok for example I want to create a car.
Ok car.
OK.
I click on this checkbox here topics that what man made I click on finish.
OK this is the blueprint for creating a car.
OK this is just a blueprint.
All classes are blueprints.
OK.
So I teach you more about classes later in this course and this is just an introduction to give you
some knowledge about these classes.
OK.
So the next thing that I want to teach you about is that the name of all classes that we create must
be the same as the name of the job or Foyle's.
Here for example as you can see this is the class that we have created.
OK.
In my class that job are fine.
OK.
And does the name of this class is my class.
So as you can see here this is that my class that job or the name of this job is my class too.
So first let me point out that if I for example change the name of this class to my classes as you can
see Eclipse is going to complain.
It's going to show me an error.
So let's see what's this error.
The public type.
My classes must be defined in its own right.
So as you can see here this class my classes is not owned by either my class that Java.
So we need to actually change it back to my class.
OK.
And let's see another example.
As you can see here I'll change the name of this class car to cars.
OK.
As you can see the name of this class is car.
OK.
And the name of the java file here is card too.
So if I change it two cars as you can see it's going to show me an error and it says the public type
cars must be defined in it's all fine.
So as you can see these cars class is not owned by this car that job is fine.
So there are some exceptions to for example Actually if I actually change this class class name here
are two cars and it's gonna show me an error.
OK.
So let's see what the error is.
Again the public high cars must be defined in its own fight as you can see it is the public type.
So let's actually delete this public here.
And as you can see the air is God and it's tested again in my classes.
So if I change into my classes the name of the class to my classes let's delete this public.
And it's going to actually delete the error for me again.
OK so what's going on.
Are all public classes as you can see in every fight in every job.
You can actually create only one public class.
OK.
You can actually create you just one fine one public fight.
OK.
But you can create unlimited classes in your files for example if I change this class to for example
if I put the public back into this class ok and change this card is class 2 car OK and it's going to
actually erase the error for me.
For example if I actually want to put another party class in this fight.
As you can see this is the end of my class.
Ok so I can add another class here public.
OK class.
OK.
So let's this time typing anymore.
OK.
The class of Haleema.
And then open and close the class by using these curly braces.
So as you can see it's going to show me an error again.
So let's see what's this error the public type animal must be defined in its own form.
So as you can see we cannot actually use public time modifier here again.
I'm going to actually tell you more about the public modifier later in this section.
But for now I just want to teach you how these are public you modify your behavior in against classes.
OK.
Now I'm going to teach you and other answers about classes.
So first let's open the mike less that Jarba.
And as you can see here we need to change the class name to my class.
And now the error is caught.
And this closing curly brace as you can see here this is the end of the class declaration.
So as I said before we can create our own limited classes in our Java files.
So for example if I want to create another class named sport I can do it this way.
Class sport.
I need to open and close my class by using these curly braces.
For example if I want to actually create another main method here I can actually type in public case
tatic.
And as you can see we can have our main method for every class that we create.
OK artics OK arguments and then I need to open and close my method by using these curly braces.
So inside this method I want to for example I put some results to the console so I can take in system
that out that princeling this system that out of that Cridland is the job was to actually outwitting
your texts to the council.
OK and I'll teach you more about these classes these methods.
But for now just memorize this and know that this is just a way to actually outputting your texts to
the council.
OK.
So inside the parenthesis I can't say I've been high for sports.
And at the end of my statement I need to put in the semi-colon.
And here again I can actually the type system.
That's how it got trained to learn.
And inside the practices I kept typing Hi from my class as you can see I am typing the name of the class
here.
So let's first run these actually application.
So I just need to Right-Click underclasses project and run as Java application.
So let's see what we have got here.
As you can see these are the classes that we have created earlier.
OK.
This is the card class.
This is the my class class and this and this is the Sports Class.
OK.
So for example if I want to run this sports class I just need to choose this sports class and cricket.
OK.
So as you can see it is going to show me high from sport.
It's going to run.
It's going to actually go inside the sport class and it's going to Randy's main method and inside the
main effect it's going to execute with this statement system that out that principle and high from sports.