Step 7.5: Reviewing the source and the generated class


Step 7.5: Reviewing the source and the generated class

click to expand

You may have noticed that when you added HelloWorld.java that it was expandable ”you could see the little plus sign to the left, which indicated there were objects underneath it. That may seem a little unusual, since this is just a source file. In the Resource perspective you wouldn't see the plus sign. So why does the Java perspective see Java source files differently?

Well, it's because the Java perspective considers the Java source file to be the parent of the Java class file. Let's take a look. Expand the source by left-clicking on the plus sign as shown in Figure 7.21, which will in turn give you the display in Figure 7.22.

click to expand
Figure 7.21: Left-click on HelloWorld.java to expand it.
click to expand
Figure 7.22: The expanded HelloWorld shows the source, the class, and the method.

q 7.5(a) Expand HelloWorld.java.

You'll see that underneath HelloWorld.java source code, with the J icon, is the HelloWorld class, with a class icon. The white C inside a green circle denotes a class, and the little running guy underneath indicates that the class has a main() method and is therefore executable (i.e., runnable-cute, eh?).

You'll notice that the HelloWorld class, which is a child of the HelloWorld.java source code in the Package Explorer view, itself has a child. Each method in the class is considered a child of the class. So beneath the HelloWorld class, you see the main() method, with a green ball icon. The green ball indicates a public method, and the red S declares it to be static (Eclipse is big on icons declaring a lot of information).

Note also that these same symbols are used in the Outline view in the upper right-hand pane.

Okay, you've entered the class. Now you get to run it. Step 8, here we come!




Eclipse
Eclipse: Step by Step (Step-by-Step series)
ISBN: 1583470441
EAN: 2147483647
Year: 2003
Pages: 90
Authors: Joe Pluta

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net