The default Java functions (methods) of the value problem

Java is not the default parameters as a function (method) setting.

The reason is the "default parameters" and "method overloading" At the same support it ambiguous question, but using the "method overloading" may indirectly achieve the effect of "default parameters", for example:

public  class A {
    public  void the doA ( int A) { 
   } 
   public  void the doA () {
        the this .doA (0); // where incoming default 0, may be achieved by overloading approximate that setting defaults 
   } 
}

 

reference:

. 1) Java default parameters can be provided as a method parameter it

Guess you like

Origin www.cnblogs.com/GjqDream/p/11617488.html