Short to int automatic promotion

后端 未结 2 1450
借酒劲吻你
借酒劲吻你 2021-01-13 21:26
public class Yikes1 {
    public static void go(Long n) {
        System.out.println(\"Long \"); // printed
    }

    public static void go(Short n) {
        Syste         


        
2条回答
  •  抹茶落季
    2021-01-13 21:58

    The binding sequence works as follows:

    1. Exact match (Ex. int--> int)
    2. Promotion (Ex. int --> long)
    3. Autoboxing/Unboxing (Ex. int --> Integer)
    4. Varags (Ex. int --> int...)

提交回复
热议问题