方法一:
public class Constants
{
public static void main(String agrs[])
{
final double CM_PER_INCH=2.54;
double paperWidth=8.5;
double paperHeight=11;
System.out.println("Paper size in centimeters:"+paperWidth*CM_PER_INCH+"by"+paperHeight*CM_PER_INCH);
}
}
Paper size in centimeters:21.59by27.94方法二:
public class Constants2
{
public static void main(String agrs[])
{
double paperWidth=8.5;
double paperHeight=11;
System.out.println("Paper size in centimeters:"+paperWidth*CM_PER_INCH+"by"+paperHeight*CM_PER_INCH);
}
public static final double CM_PER_INCH=2.45;
}
Paper size in centimeters:20.852000000000003by26.950000000000003
public class Constants
{
public static void main(String agrs[])
{
final double CM_PER_INCH=2.54;
double paperWidth=8.5;
double paperHeight=11;
System.out.println("Paper size in centimeters:"+paperWidth*CM_PER_INCH+"by"+paperHeight*CM_PER_INCH);
}
}
Paper size in centimeters:21.59by27.94方法二:
public class Constants2
{
public static void main(String agrs[])
{
double paperWidth=8.5;
double paperHeight=11;
System.out.println("Paper size in centimeters:"+paperWidth*CM_PER_INCH+"by"+paperHeight*CM_PER_INCH);
}
public static final double CM_PER_INCH=2.45;
}
Paper size in centimeters:20.852000000000003by26.950000000000003
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货