measure.java

来自「Java 入门书的源码」· Java 代码 · 共 24 行

JAVA
24
字号
//Copyright (c) 1998, Arthur Gittleman
//This example is provided WITHOUT ANY WARRANTY either expressed or implied.

/*  Evaluates AND, OR, and NOT expressions
 *  involving height and weight measurements.
 */

import iopack.Io;
public class Measure {
  public static void main(String [] args) {
    double height, weight;
    height = Io.readDouble("Enter a height in inches");
    weight = Io.readDouble("Enter a weight in pounds");
    System.out.print("height < 65 && weight < 130 is ");
    System.out.println((height < 65) && (weight < 130));
    System.out.print("height < 65 || weight < 130 is ");
    System.out.println((height < 65) || (weight < 130));
    boolean heavy = (weight > 250);
    System.out.println("heavy is " + heavy);
    System.out.println("!heavy is " + !heavy);
    Io.readString("Press any key to exit");   // Added for IDE use
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?