1. Define members in the interface
C #, I added a field N to interface ITest, then vs directly shows the red bottom line, and the error is that the interface cannot contain fields
Java, for example, the compilation is also an error but not the interface can not be included but the assignment is missing, then we will be assigned to look at the value. You can see that there is no problem, that is, the member variable defaults to public static final, we know that final must be assigned, so no assignment will compile the premises.
After assignment, it is found that there are no problems, such as.
2, the interface defines some methods
C #, we all know that the methods in an interface need subclasses to implement, then our methods in the interface can not be implemented, if the implementation is added there will be errors. The error is that the interface cannot be defined.
Java, or jdk1.8, adds some methods that can be implemented. It can be implemented in default,static. For example, the compilation is not a problem. So does C # have a default and static method? In the interface, I'm sorry No.
There is no in C #, and the interface method for Static,default is undefined. Because it is invalid.
Summarize
Simple two points different, like other exchanges together.
Java Foundation-java differs from C # interface.