A Good Way to Organize Classes With Java

Package and manage your class libraries to make it more convenient for developers to find and include your libraries. Class libraries are given a name with the main encompassing "com" package, and each sub-class is added with a dot character prefix. This naming scheme organizes your classes and packages for developers to include in projects.

Instructions

    • 1

      Open your Eclipse Java editor, then open the main class project you want to organize.

    • 2

      Click "File" and select "New Class" to open the new class library wizard. In the "Name" text box for the new class, give a name to the class that follows the hierarchy. For instance, if you make an Android app and the new class is for a website download, name the class "com.android.myapp.web." This organizes the class, so you can find it in a list of libraries.

    • 3

      Add the organized classes to a project. For instance, if you create a new class named "com.android.myapp.web," you must include the hierarchy libraries. Insert the following library to the top of the file:

      include com.android.*;

      The asterisk character tells the Java compiler to include all files under the Android class hierarchy.

Related Searches:

References

Comments

Related Ads

Featured