a Java class has two constructors, why use this when another constructor is called in one constructor. () and cannot use the class name. ()
If there is a parameter type, if the type is exactly the same then it is not possible, only a different name.
method overloading refers to defining multiple methods with the same name in a class, but requiring each method to have a different number of types or parameters. When calling an overloaded method, the Java compiler can choose an appropriate method by checking the parameter type and number of the called method. Method overloads are typically used to create a method that accomplishes a similar set of tasks but differs in the number of types or parameters of a parameter. Method overloading is a means for a class to handle different types of data in a uniform manner. Java's method overloading is that you can create multiple methods in a class that have the same name but have different parameters and different definitions. Methods are invoked by the different number and type of arguments passed to them to determine which method to use
For example:
Public void Demo (String a1,int a2) {}
Public void Demo (int a1,string A2) {}
this can
Public void Demo (String a1,string a2) {}
Public void Demo (String a2,string A1) {}
This will be an error .
This article is from the "Java White Battlefield" blog, be sure to keep this source http://8023java.blog.51cto.com/10117207/1766232
Java constructor Problems