When is method overloading "chosen"?

In languages that contain method overloading (such as Java), when does it decide “which” function to use? At compile-time, at that little funny “compile before running” step that AS3 and Java do, or at runtime?