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