Archive for November, 2008

Nov 24 2008

Java 撰寫習慣

Published by under Java 複習

好久沒寫 Blog,這邊做個筆記,來源SCJD Exam with J2SE 5

Java Coding Conventions:

Class & Interface Naming Conventions
Class and interface names should always start with a capital letter, and should be a noun.
It’s common to combine two or more moums or an adjective and a noun together to form the class name, in which case CamelCase is used (the first letter of each word is capitalized, producing the undulating pattern associated with camels). For example, “SocketFactory” might be used as the name of a class that creates socket connections.

Method Naming Conventions
Method names should always start with a lowercase letter, and should begin with a verb. For example, getLeadActor.

Variable Naming Conventions
Variable names should always start with a lowercase letter, should be short, and should describe what data is stored in the variable. For example, leadActor.

Constant Naming Conventions
Constants are always written in all capital letters, with individual words separated by underscores, like DIRECTOR_LENGTH.

No responses yet