StackOverflow 文件 Java Language 教程 斷言 用斷言檢查算術 用斷言檢查算術 Created: November-22, 2018 placeholderCopya = 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; 斷言