Java编程思想_示例代码_第02章_一切都是对象_Everything Is an Object

ExampleCode_01

ExampleCode_02

package object;

//: object/ShowProperties.java //properties 属性

public class ShowProperties {
	
	public static void main(String[] args) {
		System.getProperties().list(System.out); //getProperties 获取属性
		System.out.println(System.getProperty("user.name"));
		System.out.println(System.getProperty("java.library.path"));
  }
	
} ///:~

ExampleCode_03

package object;

//: object/Documentation1.java

/** A class comment */
public class Documentation1 {
  /** A field comment */ //field 域
  public int i;
  /** A method comment */
  public void f() {}
} ///:~

ExampleCode_04

package object;

//: object/Documentation2.java

/**
* <pre>
* System.out.println(new Date());
* </pre>
*/
public class Documentation2 {}
///:~

ExampleCode_05

package object;

//: object/Documentation3.java

/**
* You can <em>even</em> insert a list:
* <ol>
* <li> Item one
* <li> Item two
* <li> Item three
* </ol>
*/
public class Documentation3 {}
///:~

ExampleCode_06

package object;

//: object/HelloDate.java

import java.util.*;

/** The first Thinking in Java example program.
 * Displays a string and today's date.
 * @author Bruce Eckel
 * @author www.MindView.net
 * @version 4.0
*/
public class HelloDate {
  /** Entry point to class & application.
   * @param args array of string arguments
   * @throws exceptions No exceptions thrown
  */
  public static void main(String[] args) {
    System.out.println("Hello, it's: ");
    System.out.println(new Date());
  }
  
} 
/* Output: (55% match)
Hello, it's:
Wed Oct 05 14:39:36 MDT 2005
*///:~

猜你喜欢

转载自blog.csdn.net/weixin_43002838/article/details/88917429