Task 1: Set the programming environment
CSE 1321L
My First Java Program
The purpose of this handout is to show you how create, compile, and run a simple Java program using jGRASP.
1) Open jGRASP on your computer.
2) Click File ( New ( Java and a new window will open.
3) In that window, type the following text as is:
public class MyFirstProgram
{
public static void main (String[] args)
{
System.out.println ("This is my first Java program!");
System.out.println ("This program does not do much!");
}
}
4) Click File ( Save As to save the file to the hard drive (select a folder you can remember). Name your file MyFirstProgram. Notice the file name and the program name (in the first line: Public class MyFirstProgram) must be the same.
5) Now, let’s indent the code properly. Click on the Generate CSD icon, the icon next to undo red arrow pointing backward). Click the Save icon.
6) Try to click the 2 other formatting icons next to the Generate CSD icon and see what happens.
7) Now we need to compile the code. Click on the Compile icon (the green cross). Notice what the compiler displays in the lower window (Compile Messages tab). If you have syntax errors, error messages are displayed in that window.
8) Once you fix all syntax errors, you are ready to execute the program to see its results. Click the run icon (the red running person). Notice what the run-time machine displays in the lower window (Run I/O tab).
9) Now, try to intentionally generate syntax errors by making changes to the code, such removing a semi-colon, changing void to Void, changing System to system, changing println to Println, etc. Each time you make a change you need to re-compile the code.
Work this step one error at a time and carefully read and think about the error messages.
Notice that jGRASP saves your file each time you try to compile the code.
Get Organized: For each Lab and Homework Assignment, create a separate folder with proper name to save all programs for that lab or assignment.
Instructions:
1. This practice must be completed and working correctly.
2. The program must be checked by the end of the designated lab session.
3. Source code (.java) should be uploaded to D2L by due date.
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- task 1 set the programming environment
- how to run java program with tester library using netbeans
- editing compiling and executing a program
- exercises siue
- creating compiling and running java programs
- lab 1 write run print
- how to write compile and run a simple java program
- how to run java program with tester library using eclipse ide
- how to run and trace a program in eclipse version 3
- notepad
Related searches
- ielts writing task 1 examples
- ielts writing task 1 language
- ielts speaking task 1 questions
- ielts writing task 1 vocabulary
- ielts general writing task 1 sample letters
- ielts general writing task 1 sample test
- ielts writing task 1 maps
- ielts writing task 1 practice
- ielts writing task 1 sample
- ielts speaking task 1 topics
- ielts writing task 1 ppt
- ielts writing task 1 samples