This is explained in JLS 15.12.2.1
In plain English:
Compiler looks for a declaration, that matches the invocation, in the declared type (compile type) of the reference used for the invocation. And in all it supertypes.
It must be both accesible (regarding access modifiers), and aplicable. A declaration is aplicable for an invocation if the number of parameters is the same, and the type of the parameters in the invocation are the same or widenning asignable to those in the declaration.
If several methods are both asignable and accessible the most especific is chosen. If there is not one declaration that is more
more especific to the others declarations, compilers complains saying that the method call is ambigous.
A method declaration is more especific than other if it resides in the same class or a subclass of the one containning the other declaration; and, each type of its parameters is the same or can be asigned to the type of the parameters of the other via a widenning convertion.
In the first example:
methodA(3); //compile err
because an int is both widenning asignable to long or float, the two methodA are aplicable. Given that both are accessible we need to choose the most especific. Well, long is widenning asignable to float, but it is on the father class, so it can't be widenning asigned to its subclass. As a result none of them is more especific and the invocation is ambigous.
methodA(3L); //compile err
the same happens here. long is aplicable to both methods but none of them is more especific.
methodA(3F); //compile OK
only the method receiving a float is aplicable to 3F.
The second code can be reasoned similarly.
Please read this to place the code between marks that will ident it.
http://www.javaranch.com/ubb/ubbcode.html