1. Can the construction method inherit? Can the construction method be overloaded?
The constructor method cannot inherit, but the subclass will invoke the parent class's constructor method to produce the parent class object, which can be overloaded by the quilt class;
2. What is the difference between final, finally and finalize?
Final modifier method, variable, class. A decorated class means that the class cannot be inherited, and a decorated method means that the method cannot be overridden, and a decorated variable indicates that the value of the variable cannot be changed.
Finally, the code block, which is usually used for the closing of the stream, the shutdown of the database, and so on, whether or not there is an exception, will be executed.
Finalize () The method is defined in object to indicate that the virtual machine does some cleanup before the object is garbage collected;
3. What are the access modifiers? What is the scope of their respective scopes?
Public in common, all classes can be accessed;
Private, only this class can access
Protected protected, this package or the different buns class can be accessed
Default; This package can be accessed
4. What is an internal class? What is the name of the inner class file?
is a class in the definition of a class, this class is an inner class, the inner class is equivalent to the properties of the outer class, so the creation of the inner class object depends on the outer class object;
Internal class naming rules: External class name $ internal class name. class
5, what is polymorphic? What are the characteristics of polymorphism?
Polymorphic: Allows a parent class object to reference the object of the subclass, allowing an interface variable to point to the implementation class object, which in turn does not work;
Polymorphism can use dynamic binding mechanism to achieve the same behavior, different implementation mode;
The parent class points to the child class object, and the variable can only point to the parent class method and property, and cannot invoke the method property unique to the subclass
Java Fundamentals 6