03 eclipse basics & hello world
TRANSCRIPT
Mobile App:ITEclipse Basics and Hello World
IHS GIRLS TECH CLUB: ECLIPSE BASICS AND HELLO WORLD
CREATING YOUR FIRST JAVA PROGRAM
The first steps in creating our Hello World program is to create our Java projectTo do this click on File/New/Project
CREATING YOUR FIRST JAVA PROGRAM
This will open the New Project Wizard.
Select Java Project and click Next>
For the Project Name type "HelloWorld" and click Finish
All other fieldscan remain in theirdefault setting
After the project has been created, you have to create a class. To do this, go toFile/New/Class
Under Source folder browse and find the src for the project you created earlier. When completed the source folder text field should read HelloWorld/src
For the class name enter "HelloWorld"
Make sure that the "public static void main(string[] args)" checkbox is checked.
All other fields may be left as default
Click Finish
We have now created both the project and class. These steps will have to be completed every time we start a new java program.
Once you create a class your .java program should load and look like this. At this time don't worry about what everything means, we will cover that as the class moves forward
WRITING THE CODE
As you have already learned, Java follows simple syntax when writing program instructions.
To write the code for Hello World type the following inside the main method.
Click Save
UNDERSTANDING THE CODE
If we were to break out the line of code we just wrote it would read as follows.
Computer (system) output (.out) this line (println) Hello World! ("Hello World!";).
RUNNING THE CODE
To run your code, click on Run/Run As/Java Application
Doing this will load a dialog box where you select your HelloWorld.java file. Click OK
You can also click on Run/Run to do the same thing.
VIEWING THE CONSOLE
By default you should see the output of your .java program below in the console section. If the window is not appearing click on Window/Show View/Console
If the code has been added correctly you should see Hello World being outputted.
HELLO WORLD OVERVIEW
1.Create a project (HelloWorld)2.Create a class (HelloWorld)3.Add code (System.out.println("Hello World!");4.Run code (Run/Run As/Java Application)
These are the four basic steps to all Java programming.
Now Change the Hello World text to say “Your Name” and run the application.
NEED MORE HELP?
Eclipse comes with its own Hello World tutorial. You can access the tutorial from the Welcome Screen.
To get to the Welcome Screen select Help > Welcome from the menu bar. Click the tutorials icon and then select Create a Hello World Application.
This tutorial walks you through the entire Hello World application building process.