public class Test
{
public static void printValue(int i, int j, int k)
{
System.out.println("int");
}
public static void printValue(byte...b)
{
System.out.println("long");
}
public static void main(String... args)
{
byte b = 9;
printValue(b,b,b);
}
}
The output of the above code is "int". But it should be "long" because byte type argument function is already present. But here the program is promoting the byte values to int, but it should not be the case.
Please can someone clarify what is going on here?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…