BINARY COMPATIBILITY
Method and Constructor Overloading
13.4.22
the method is
private
 to its class
an entire package is guaranteed to be kept together and the method is accessi 
ble only within that package
a set of Java code is being compiled to a special binary format where the spec 
ified method is available only within a binary or set of binaries which are
being kept together.
The keyword
final
 on a method does not mean that the method can be safely
inlined; it only means that the method cannot be overridden. Unless the compiler
has extraordinary knowledge, it is still possible that a new version of that method
will be provided at link time.
In general we suggest that Java implementations use late bound (run time)
code generation and optimization.
13.4.22   Method and Constructor Overloading
Adding new methods that overload existing method names does not break com 
patibility with pre existing binaries. The method signature to be used for each
method invocation was determined when these existing binaries were compiled;
therefore newly added methods will not be used, even if their signatures are both
applicable and more specific than the method signature originally chosen.
While adding a new overloaded method or constructor may cause a compile 
time error the next time a class or interface is compiled because there is no
method or constructor that is most specific ( 15.11.2.2), no such error occurs
when a Java program is executed, because no overload resolution is done at execu 
tion time.
If the example program:
class Super {
static void out(float f) { System.out.println("float"); }
}
class Test {
public static void main(String[] args) {
Super.out(2);
}
}
is compiled and executed, it produces the output:
float
Suppose that a new version of class
Super
 is produced:
257






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Inexpensive Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Jsp Hosting Cheap Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved