有很多网站是 Java 面试题答案的良好资源。以下是几个最受欢迎的网站:Tutorialspoint www.Tutorialspoint.com StackOverflow www.stackoverflow.com DZone www.dzone.com Wikipedia www.wikipedia.org IBM Developer Works www.ibm.com/developerworks/java/
类型提升是指将较低大小的数据类型(如 int)传递给较高大小的数据类型(如 long)。在这种情况下,方法重载是可能的。示例实时演示public class Tester { public static void main(String args[]) { Tester tester = new Tester(); short c = 1, d = 2; int e = 1, f = 2; System.out.println(tester.add(c, d)); System.out.println(tester.add(e, f)); } public int add(short a, short b) { System.out.println("short"); return a + b; } public int add(int a, int b) { System.out.println("int"); return a + b; } }输出Short 3 Int 3