think in java 笔记1

/*
 * (#)ThinkAboutRT.java 1.0 2013-9-24 2013-9-24 GMT+08:00
 */
package test;

import java.util.Date;
import java.util.Properties;

/**
 * @author di.wang
 * @version $1.0, 2013-9-24 2013-9-24 GMT+08:00
 * @since JDK7
 */
public class ThinkAboutRT {
    
    
    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());
	System.out.println("free memory" + rt.freeMemory());
    }

}





1.高精度运算,BigInteger 计算任意精度的整形
              BigDecimal 任意精度的浮点数字
2.主类型(int long 等)作用域为花括号内{};
  对象作用域不具备与主类型一样的存在时间,用new创建一个新对象后,
 
 {
 String s = new String("abc");
  }/* 作用域终点*/
 

  句柄s会在作用域终点消失,但是s指向的String对象会一直存在。

猜你喜欢

转载自republicw.iteye.com/blog/1946542