【Java】三元运算符 类型提升 问题
代码片段:
@Test public void test() { Object o = true ? new Integer(1) : new Double(2); System.out.println(o); System.out.println(o instanceof Double); }
执行结果:
1.0 true Process finished with exit code 0
问题来源:
https://blog.csdn.net/MantisShrimp/article/details/121640105