Java: Basic Class File

In this tutorial I will show you how to create a basic Class file and explain what it does and how it works.
If you open up Eclipse in the map where you want to keep all of the files for your program it will open up with a screen that looks like this.

Now click the Workbench button on the top right. This will take you to a screen that looks like this.

Now right click in the area on the right just under Project Explorer. Then select New, Project, Java Project. After that click next and select a name for your Project. The name of this project will be where the your program is saved on your pc. It will also be the name used in several windows inside of Eclipse. Make sure you select JavaSE-1.7 and then click Finish and Yes.
Once you have done this you will see a project with the name you gave it on the top right. Click the arrow next to it to open the 2 things in there. One is the src folder and the other JRE System Libraries.
Now you have set up the first part of your Project. The next part is to create a file inside of a package. A package is the folder structure where the files will be saved in. The package name is usually net.nameoftheprogram.src. After that you might get some more subfolders, but you don’t have to worry about that for a long while, because that is only used when you are making really big things like big games. For this tutorial we will begin small.
To create a package you have to right click the project and select New, Package. This will open up a window. Type in the name you want your package to have and click Finish.
Now right click your package and select New, Class. Typ in the name you want and once again click Finish. Once you have done that it will open up the file in the middle screen. It will also show you where the file is in the top right and it will show you a little something in the bottom right called Outline, but I will explain about that later.
Right now your Eclipse should look something like this.

In the next tutorial I will show you how to add the first and most basic lines of code to your very first Class file.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">