public class Property {
/**
*
* @param args the args is a parative
*/
public static void main(String[] args) {
System.out.println(new Date())
Properties p = System.getProperties()
p.list(System.out)
System.out.println("--- Memory Usage:")
Runtime rt = Runtime.getRuntime()
System.out.println("Total Memory = "
+ rt.totalMemory()
+ " Free Memory = "
+ rt.freeMemory())
}
}
在CMD运行:javac -d docDirectory nameOfPackage(docDirectory是.html保存的路径,nameOfPackage是需要提取注释的包的名称)
如果只要Property类的.htm,在当前目录,则在CMD运行:javac Property.java(已经在Property所在路径)
有两种方式:一是html方式注释,而是jsp方式注释。
html方式注释:在jsp标签的左右尖括号中添加注释语句。(下面注释了c:out标签)
<!-- c:out ... -->sp方式注释:把要注释的内容用jsp代码标记包含并注释:
<% /*<c:out ...>
*/%>
推荐第二种,因为第一种会将你的代码暴露在最终的html中,而且也增加了页面大小。
看过java API么?那个文档就是根据嵌入式html生成的,什么叫嵌入式html?就是把html嵌入到了java源文件中作用就不用明说了,如果没有java api,写代码是多么的痛苦!
/**
* The <code>String</code>class represents character strings. All
* string literals in Java programs, such as <code>"abc"</code>, are
* implemented as instances of this class.
* <p>
* Strings are constanttheir values cannot be changed after they
* are created. String buffers support mutable strings.
* Because String objects are immutable they can be shared. For example:
* <p><blockquote><pre>
* String str = "abc"
* </pre></blockquote><p>
* is equivalent to:
* <p><blockquote><pre>
* char data[] = {'a', 'b', 'c'}
* String str = new String(data)
* </pre></blockquote><p>
* Here are some more examples of how strings can be used:
* <p><blockquote><pre>
* System.out.println("abc")
* String cde = "cde"
* System.out.println("abc" + cde)
* String c = "abc".substring(2,3)
* String d = cde.substring(1, 2)
* </pre></blockquote>
* <p>
* The class <code>String</code>includes methods for examining
* individual characters of the sequence, for comparing strings, for
* searching strings, for extracting substrings, and for creating a
* copy of a string with all characters translated to uppercase or to
* lowercase. Case mapping is based on the Unicode Standard version
* specified by the {@link java.lang.Character Character} class.
* <p>
* The Java language provides special support for the string
* concatenation operator ( + ), and for conversion of
* other objects to strings. String concatenation is implemented
* through the <code>StringBuilder</code>(or <code>StringBuffer</code>)
* class and its <code>append</code>method.
* String conversions are implemented through the method
* <code>toString</code>, defined by <code>Object</code>and
* inherited by all classes in Java. For additional information on
* string concatenation and conversion, see Gosling, Joy, and Steele,
* <i>The Java Language Specification</i>.
*
* <p>Unless otherwise noted, passing a <tt>null</tt>argument to a constructor
* or method in this class will cause a {@link NullPointerException} to be
* thrown.
*
* <p>A <code>String</code>represents a string in the UTF-16 format
* in which <em>supplementary characters</em>are represented by <em>surrogate
* pairs</em>(see the section <a href="Character.html#unicode">Unicode
* Character Representations</a>in the <code>Character</code>class for
* more information).
* Index values refer to <code>char</code>code units, so a supplementary
* character uses two positions in a <code>String</code>.
* <p>The <code>String</code>class provides methods for dealing with
* Unicode code points (i.e., characters), in addition to those for
* dealing with Unicode code units (i.e., <code>char</code>values).
*
* @author Lee Boynton
* @author Arthur van Hoff
* @version 1.188, 09/14/04
* @see java.lang.Object#toString()
* @see java.lang.StringBuffer
* @see java.lang.StringBuilder
* @see java.nio.charset.Charset
* @since JDK1.0
*/
这是java String类开始的一段文档,看里面用了很多html标签,所谓嵌入式html也
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)