Archive for the 'Java 複習' Category

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

Dec 06 2007

Javadoc 筆記

Published by under Java 複習

Where to put:

  • Class comments: appear immediately before the class declaration
  • Class and instance variable comments: appear immediately before the class or instance variable to which they belong.
  • Method comments: appear immediately before the method signature.

Commonly used HTML tags in javadoc:
(Javadoc produces output conforming to HTML standard 3.2)

  • <code>…</code>
    appear in monospaced font in the HTML output. It is designed for short words or phases, such as Java keywords, package names, class and interface names, method names, field names, and argument names.
  • <pre>…</pre>
    monospaced font, the same with <pre> tags in standard HTML.
  • <ul>…</ul>
    Denotes the start and end of an unordered list (not numbered).
  • <ol>…</ol>
    Denotes the start and end of an unordered list (numbered).
  • <li>
    A dot before the start.
  • <p>
    paragraph.

Class and Interface Tangs

  • @author
  • @version
  • @see
    Generates a link to the specified class or method, appear in a special “See Also” section of the generated Javadoc.
  • @since
    Used to indicated the version number of your release in which this class first appeared.
  • @deprecated
  • @serial
  • {@link reference label}
  • {@linkplain reference label}
  • {@docRoot}

待續……

No responses yet