1. 程式人生 > 其它 >Java語言-使用static final宣告類常量。

Java語言-使用static final宣告類常量。

技術標籤:Java語言

//檔名:ConstantsExample2.java
public class ConstantsExample2 {
	public static final double M=2.54;
	public static void main(String[] args) {
		double width=8.5;
		double height=11;
		System.out.println("paper size in centimeters:"+width*M +" by "+height*M);
	}
}