logo
  • 教程列表
  • SO官方文檔
  • 斷言
    • 用斷言檢查算術
  1. StackOverflow 文件
  2. Java Language 教程
  3. 斷言
  4. 用斷言檢查算術

用斷言檢查算術

Created: November-22, 2018

a = 1 - Math.abs(1 - a % 2);

// This will throw an error if my arithmetic above is wrong.
assert a >= 0 && a <= 1 : "Calculated value of " + a + " is outside of expected bounds";

return a;
  • 斷言

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 關於本站
  • 免責聲明