package part1; public class Constants { /** * 在java中利用关键字final来声明常量 */ public static void main(String[] args) { final double CM_PER_INCH = 2.54; //final表示这个变量只能赋一次值 double paperWidth = 8.5; double paperHeight = 11; System.out.println("Paper size in centimeters : " + paperWidth * CM_PER_INCH + " by " + paperHeight * CM_PER_INCH); } }