Java Fundamentals Refresher (b)

Abstract classes and abstract methods:

An abstract class is not instantiated

 

 

 

 Anonymous subclass of abstract class:

 

 

 

 interface

java by the new interfaces when the object to anonymous inner classes (lambda expression) of the method is not implemented manner, so as to achieve the effect of the new objects!

 

 8. The specific use of the interface, such as parameters reflect polymorphism is Usb computer interface need to pass parameters to achieve Usb interface Flush

Embodies oriented programming interface

9. The interface can be considered as the norm

Java class can implement multiple interfaces

 

 

 

 If a subclass (or implementation class) inherits the parent class and interface declared in the parameters of the same name with the method, the subclass does not override another method with the same parameters of the same name in the parent class Mok Oh this method still out case - --- "category priority principle

If implemented class implements a plurality of interfaces, a plurality of default method defined in the interface with the same name as the parameter, and then the achievement of the class does not override, the interface method must be rewritten conflict

How then subclass (or implementation class) method call the parent class or interface:

 

 Inner classes

 

 abnormal

 

 

 

 

 

 error is not generally write the code targeted for processing

Red: abnormal compiled Blue: runtime exception

 

 Exception Handling way:

Method 1: try catch finally

Second way: throws 

try-catch-finallly abnormal, so that when the processing is no longer being given the compiler at compile time too, but may still run error.

Equivalent to using the structure may appear unusually delay time appears to run a compile-time.

 

 How to choose which developed an unusual use:

 

Guess you like

Origin www.cnblogs.com/doyi111/p/12565906.html