Step 10.2: Add a new class, HelloHSQL

Step 10.2: Add a new class, HelloHSQL


At this point, you can either add a new class and type in the code, or import the class directly from the included CD-ROM. If you would like more practice with the editor, then continue with Steps 10.2 and 10.3. If you would rather just import the code and move on to testing, then skip ahead to Step 10.4.

click to expand

q 10.2(a) Make sure the SWT project is selected.

q 10.2(b) Right click in the Package Explorer, select New/Class.

click to expand
Figure 10.9: Creating a new class using the New/Class menu option.

q 10.2(c) Make sure the Source Folder is 'SWT'.

q 10.2(d) Leave Package blank.

q 10.2(e) Leave Enclosing type unchecked.

q 10.2(l) Enter 'HelloHSQL' in the Name field.

q 10.2(g) Make sure public is checked, abstract and final are unchecked.

q 10.2(h) Leave Superclass as java.lang.Object, Interfaces blank.

q 10.2(i) Make sure public static void main(String[] args) is checked.

q 10.2(j) Leave Constructors from superclass and Inherited abstract methods unchecked.

q 10.2(k) Click Finish.

click to expand
Figure 10.10: Setting the fields properly for a new class.

This will create a public class HelloHSQL in the default package (because you left Package blank) in project SWT. In Steps 10.2(i) and 10.2(j) you instructed the IDE to create a standard "main" method but no other methods. That being the case, you will see the result as in Figure 10.11.

click to expand
Figure 10.11: The result of the addition of the new class HelloSWT.

Eclipse: Step by Step (Step-by-Step series)
ISBN: 1583470441
EAN: 2147483647
Year: 2003
Pages: 90
Authors: Joe Pluta
Similar book on Amazon © 2008-2017.
If you may any questions please contact us: