以下三段代码的输出分别是什么?为什么会有这样的结果?
<!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
-->1 public class BoxingTest {
2
3 public static void main(String[] args) {
4 System.out.println(true ? null : 0);
5 }
6
7 }
2
3 public static void main(String[] args) {
4 System.out.println(true ? null : 0);
5 }
6
7 }
<!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
-->1 public class BoxingTest {
2
3 public static void main(String[] args) {
4 System.out.println(true ? (Integer) null : 0);
5 }
6
7 }
2
3 public static void main(String[] args) {
4 System.out.println(true ? (Integer) null : 0);
5 }
6
7 }
<!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
-->1 public class BoxingTest {
2
3 public static void main(String[] args) {
4 System.out.println(true ? (Integer) null : new Integer(0));
5 }
6
7 }
2
3 public static void main(String[] args) {
4 System.out.println(true ? (Integer) null : new Integer(0));
5 }
6
7 }
Java三元运算符解析
1528

被折叠的 条评论
为什么被折叠?



