Presentation is loading. Please wait.

Presentation is loading. Please wait.

Hello World in the Forte IDE An introduction to the Forte IDE (integrated development environment) writing the classic “Hello World” program in Java.

Similar presentations


Presentation on theme: "Hello World in the Forte IDE An introduction to the Forte IDE (integrated development environment) writing the classic “Hello World” program in Java."— Presentation transcript:

1 Hello World in the Forte IDE An introduction to the Forte IDE (integrated development environment) writing the classic “Hello World” program in Java

2 Create a folder for your projects One way is to use Windows Explorer (WE) On the left-hand-side of WE, click on the location where the folder is to be created On the right-hand-side of WE, right click in the open area and choose from the menu New and then Folder

3 Create a New Folder

4 Rename the Folder Right click on the Folder and choose Rename, then type the name, press ENTER

5 Start Forte: Start/Programs/Forte for Java CE/ Forte for Java CE

6 Start Forte (Alternative): Double click on the runidew icon found in forte4j/bin

7 Close Tip Window (if it appears)

8 Forte at Startup Explorer window Properties window Main window: menus and toolbars Desktop showing through Filesystems, see next slide

9 Right click on Filesystems (circled on previous slide) in the Explorer Window Choose Mount Directory from the menu

10 The Mount Directory Dialog Box

11 Use the Mount Directory “Look in” drop-down box to choose a drive and the region below to select a folder

12 Alternative: Choose File then Mount Filesystem on the Main Window menu to bring up the dialog box shown below Type the folder’s path or “Browse” for it, then click OK

13 To remove any previous Filesystem, right click on it and choose Unmount Filesystem

14 Java Packages In order to facilitate “portability” (moving a program from computer to computer), Java breaks references to a file’s (complete/full) path (its location) into two parts –An external part (known as the CLASSPATH) which will change as the program is moved around (mounted) –An internal part which will not change as the program is moved around (package.class) The dividing line is a folder known as “a package”

15 To create a package for your project, right click on the particular filesystem and choose New Package

16 Name the package NOTE: Java’s convention is that only class names are capitalized, Java is case sensitive: hello  Hello small letter

17 Make your package part of current project (click Yes)

18 Right click on package folder, select New/Classes/Main This template (Main) has a method (main) needed to start execution

19 Name your class; Java convention is that class name are capitalized Capital letter

20 Finish For the simple Hello World project in this example, one might as well click Finish at this stage However, we will step through a series of dialog boxes that may prove useful when writing future projects

21 Dialog Box #1 Click Next

22 Dialog Box #2

23 Dialog box #3 Most classes have fields (or properties) and we could begin to list them here

24 Dialog box #4 Classes also have methods which could be added here

25 Make class part of current project

26 The Source Editor Window appears. This is where we will type the code. Some code is already provided.

27 Source editor comments package Beginning of class

28 Some features Comment: anything between /* and */ is a comment — they are ignored by the computer and are there for the sake of the programmer or anyone else reading the code The Hello class begins with the line public class Hello extends Object –public, class and extends are keywords or reserved words, which is why they are in a different color

29 Hello World For this simple program, we will add just one line to what was supplied by the IDE That line is System.out.println(“Hello World.”); It belongs inside the curly brackets associated with the main method Curly brackets {} set off a unit of coding known as a block

30 The main method the main method Constructor, not needed for this program

31 Indenting scheme convention Free-formatting: white space (spaces, tabs, returns) are usually ignored by the computer when interpreting Java To make the program more readable (not to the computer but to the human beings), certain conventions are followed One convention is to place the curly brackets on a line by themselves and have them vertically aligned (indented the same amount) and then anything within the curly brackets is indented further

32 Start typing the line After typing the period, notice the pop- up menus

33 Java is case-sensitive In the one line, System (a class) must be capitalized, out (an object) must not be capitalized The pop-up menus provide the properties and methods associated with a class or object If they do not pop up, it is a good indication that there is a typo

34 Hello World Program

35 Right click on Hello (the class not the package) and choose Compile

36 The Output Window appears if there are errors; In this case there is a missing semicolon Error reported on line 28 although line with missing semicolon is line 27 (free –formatting)

37 Edit (add semicolon), Compile again, then Execute: Right click on class and choose Execute

38 Output Window

39 Execution Shortcut

40 Build and Compile Shortcuts

41 Windows Explorer


Download ppt "Hello World in the Forte IDE An introduction to the Forte IDE (integrated development environment) writing the classic “Hello World” program in Java."

Similar presentations


Ads by Google