2.2. 抬升式引用约定

终端输出和源代码列表要与周围文本明显分开。

将发送到终端的输出设定为 Mono-spaced Roman 并显示为:

  1. books Desktop documentation drafts mss photos stuff svn
  2. books_tests Desktop1 downloads images notes scripts svgs

源码列表也设为 Mono-spaced Roman,但添加下面突出的语法:

  1. package org.jboss.book.jca.ex1;
  2. import javax.naming.InitialContext;
  3. public class ExClient
  4. {
  5. public static void main(String args[])
  6. throws Exception
  7. {
  8. InitialContext iniCtx = new InitialContext();
  9. Object ref = iniCtx.lookup("EchoBean");
  10. EchoHome home = (EchoHome) ref;
  11. Echo echo = home.create();
  12. System.out.println("Created Echo");
  13. System.out.println("Echo.echo('Hello') = " + echo.echo("Hello"));
  14. }
  15. }