java - Are compile time and class loading time the same? -
i asking question because in collection
see arrays.sort()
overloaded, wondering how can static method overloaded, when static methods loaded @ class loading time, , overloading performed after class loading time.
my main question is: overloading , overriding performed after class loading time; that's why visible objects , invisible static parts. can static methods overloaded?
compile time , class load time not same thing. , run time (in sense use term in following ...) different again.
overload analysis performed @ compile time, both static
, instance method calls. same true cases 1 static
method shadows static
method - resolved @ compile time.
override dispatching (for instance methods) occurs @ run time; i.e. when method call occurs, depending on actual object "target" object.
why arrays.sort() overloaded , when static
why shouldn't be?
as said, both static
, instance methods can overloaded. (overriding restricted instance methods, , instance methods ... overloading can used kinds of methods, , constructors too.)
also "loading" , "overloading" totally unrelated concepts. "loading" getting classes (in case) memory, "overloading" different methods different signatures have same name.
Comments
Post a Comment