Tag: 条件 运营商

Java中的Tricky三元运算符 – 自动装箱

我们来看下面代码片段中简单的Java代码: public class Main { private int temp() { return true ? null : 0; // No compiler error – the compiler allows a return value of null // in a method signature that returns an int. } private int same() { if (true) { return null; // The same is not possible with if, […]