Referring to Java overloading - long and float, which mentions rules in JLS #15
The following rules define the direct supertype relation among the primitive types:
double >1 float
float >1 long
long >1 int
int >1 char
int >1 short
short >1 byte
where "S >1 T" means "T is a direct subtype of S", as per JLS #4.10 immediately above this section.
Why is the following code prints float?
int q = 2;
a(q);
void b(long a) {
System.out.println("long");
}
void a(float a) {
System.out.println("float");
}