Although the details of each step may differ depending on whether you are using a Java development tool, the steps involved in creating your own class generally include the following:
Define your class.
Write the Java code that defines your class. If you are using the Sun Java SDK then you can use a text editor. If you are using a development tool, the development tool provides instructions.
User classes must be 100% Java. Native methods are not allowed.
Name and save your class.
Save your class declaration (Java code) in a file with the extension .java. Make certain the name of the file is the same as the name of the class and that the case of both names is identical.
For example, a class called Utility should be saved in a file called Utility.java.
Compile your class.
This step turns your class declaration containing Java code into a new, separate file containing byte code. The name of the new file is the same as the Java code file, but has an extension of .class. You can run a compiled Java class in a Java Runtime Environment, regardless of the platform you compiled it on or the operating system of the runtime environment.
The Sun JDK contains a Java compiler, javac.
Discuter à propos de cette page dans DocCommentXchange.
|Copyright © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0|