Common exceptions and reference data type conversion

Common exceptions:
1.ArrayIndexOutOfBoundsException: array subscript index exceeds the bounds exception [0, L -1]
2.NullPointerException: null pointer exception
. Object Properties
Object method
if the object is null, null pointer exception occurs
3.ClassCastException : type conversion abnormality
in the downward transition may occur

Reference data type conversion
to convert between the parent-child class, during compilation
1. upcast (UpCasting): From the subclass - 'parent class, the class of the object handle assigned to the variable when the parent class
2. The downward transition (DownCasting): when "subclass the parent class variable assignment to a variable subclass - from the parent class

Guess you like

Origin www.cnblogs.com/start-from-scratch/p/12597153.html