Public Interface A { publicvoid B (); void c (); void d ();}
What's wrong with the M extension connector?
Public class Implements a{ void B () { } publicvoid C () { } publicstaticvoid D () { }}
1.bd problem, c no problem
2. Override the rule access modifier must be greater than the overridden method's access modifier (public>protected>default>private)
Abstract static methods cannot be defined in 3.java all of the member methods in Static,interface are abstract, and of course, static method statics cannot be defined.
4. All methods in an interface are abstract, and all member variables are public static final.
rules for overriding methods :
1. The parameter list must be exactly the same as the overridden method, otherwise it cannot be called overridden instead of overloaded.
2, the returned type must always be the same as the return type of the overridden method, otherwise it cannot be called overriding but overloaded.
3. The access modifier must be greater than the access modifier (public>protected>default>private) of the overridden method
4. The overriding method must not throw a new check exception or a more general type of check exception than the overridden method declares. For example:
A method of the parent class states that a check exception ioexception, in overriding this method is not able to throw exception, can only throw IOException subclass exception, can throw non-check exception.
Instead of overloading the rules:
1, must have a different list of parameters;
2, can have not scold return type, as long as the parameter list is different;
3, can have different access modifiers;
4, can throw different anomalies;
The difference between overrides and overloads is that:
Overriding polymorphism works, and calling overloaded methods can greatly reduce the amount of code input, and the same method name can have different functions or return values as long as it passes different parameters inside.
With good rewriting and overloading, you can design a clear and concise class that can be said to be overridden and overloaded in a way that is very unusual in the process of writing code.
7. Interface, static method