temptable.txt
来自「java的一经典教程」· 文本 代码 · 共 31 行
TXT
31 行
// Program to output a table of Celsius and Fahrenheit temperatures
// from -10 to +10
public class TempTable
{
public static void main(String[] args)
{
final double FACTOR = 9.0/5.0;
// ratio of F degree to C degree
final double SHIFT = 32; // 0 C = 32 F
final int START = -10;
final int FINISH = 10;
int thisTemp = START;
double thisInFahrenheit;
// print table headings
System.out.println("Celsius Fahrenheit");
// print table rows
while (thisTemp <= FINISH)
{
thisInFahrenheit = thisTemp * FACTOR + SHIFT;
System.out.println(thisTemp + " " +
thisInFahrenheit);
thisTemp++;
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?