Overloading is invalid
1. When talking about the parameter list, the return type of the method is not discussed.
2. If two methods have the same name, the same parameters and different return types, then this is not a valid method overload and will result in a compilation error.
int add(int, int) float add(int, int)
Overloading Description
In a class, there are two or more methods with the same method name but different parameter lists. These methods are called each other. Overloaded methods.
Overloading Note
(1) Static polymorphism is also called compile-time binding or early binding.
(2) Static binding occurs during the compilation process. Method overloading is an example of static binding, where method invocation defines binding that occurs during compilation.
The basic data types of Java are divided into:
1. Integer type, used to represent the data type of integer.
2. Floating point type, a data type used to represent decimals.
3. Character type. The keyword of character type is "char".
4. Boolean type is the basic data type that represents logical values.
The above is the detailed content of How to solve the invalidity of java method overloading. For more information, please follow other related articles on the PHP Chinese website!