作者seekyou (galagala~N )
看板java
标题[问题] boxing/unboxing
时间Thu Jan 25 21:50:59 2007
public class Yikes {
1.public static void go(Long n){System.out.println("Long ");}
2.public static void go(Short n){System.out.println("Short ");}
3.public static void go(int n){System.out.println("int ");}
4. public static void main(String[] args) {
5. short y=6;
6. long z=7;
7. go(y);
8. go(z);
9. }
10.}
这是SCJP模拟试题,output是 int Long
为什麽line 8 有找到对应的方法而印出 Long,而line7就没有呢?
谢谢指导
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 218.167.40.9