W2-Presentation-Getting To Know The Programming Environment
W2-Presentation-Getting To Know The Programming Environment
environment
At the end of this lesson you should be
able to:
• Compile and run Java code using Command Line and Netbeans.
• Differentiate the three types of error, the syntax errors, runtime errors and
logical errors.
A. The “Hello World!” application, your
first Java Program
The “Hello World!” application, your first Java Program
To save the file in notepad, on the menu bar, The Save dialog box will show up, navigate to drive
click file then select "save as". C and then select the folder that you created a
while ago.
On the file name input box, enter "HelloWorld.java" and
change the "Save as type" to "All Files" and then click
save.
Step 4. Compiling the source code using the windows command
line.
• Brackets such as curly braces “{}”, parentheses “()“ and square brackets “[]” is
not properly matches.
Runtime Errors
-occurs after compilation (when there is no syntax error in the
program) and running your program.
Runtime is when the program is running therefore you can only encounter
runtime error during execution of the program or when you are using your
program.
The figure below shows that the program was
successfully compiled and didn’t produce syntax
error, however when we tried to run the program,
we encountered runtime error
To open the NetBeans program, double The figure below shows the graphical user interface
click the NetBeans shortcut icon in your (GUI) of the NetBeans IDE.
desktop.
Step 2. Creating a project.
After clicking the New Project, a New Project
To create a project, in the IDE
dialog bar will show up. On the category list, select
menu bar choose File then click
Java and on the Project list, select the Java
New Project.
Application, then click the Next button.
In the New Application Dialog, do the following (as shown in the figure below):