|
The Java naming schemes page shows how naming in Java should be done. Naming of files, classes, variables, methods, etc has great significance and standards must be followed. In general, all names should be brief, however, they must be descriptive and accurate. Files: All Java files must be of the same name as the class they are defining, so the file and class name have the same standard. Also, note that the constructor will share this same name. The class name should be descriptive. More than likely, it will be of multiple words. Each word should have the first letter capitalized. Ex: SpeechDisplay.java and public class SpeechDisplay AudioSignal.java and public class AudioSignalVariables: Static variables and constant variables should be in all capital letters. Each word should be separated by a '_' character. Ex: public final static int DEFAULT_SIZE = 1024;All other variables should be in all lower case letters with a '_' character between words. If the variable is a class data member, "_d" should appear at the end of the variable name. If the variable is used for input or output to data methods "_a" should be at end of variable name. Ex: int capacity; // regular variable name Object[] buffer_d; // class data member boolean blocking_write_d; // class data member int offset_a; // input/output variableMethods: Methods should have every word in the name capitalized except for the first word. Ex: int getNumElements() boolean isEmpty()Go to previous page Go to next page |
|
|
Home |
Projects |
Publications |
What's New |
Contact |
About Us |
Search |
Up
|
|