First, let's talk about the differences between final, finally, and finalize.
Final? Modifier (keyword) If a class is declared as final, it means that it cannot generate a new subclass and cannot be inherited as a parent class. Therefore, a class cannot be declared both abstract and final. Declare variables or methods as final to ensure that they are not changed during use. Variables declared as final must be declared with an initial value, which can only be read and cannot be modified in future references. Methods declared as final can only be used and cannot be overloaded.
Finally? Finally blocks are provided for troubleshooting. If an exception is thrown, the matched catch clause is executed, and the control enters the finally block (if any ).
Finalize? Method Name. Java technology allows you to use the finalize () method to clear objects from the memory before the Garbage Collector clears them. This method is called by the garbage collector when it determines that this object is not referenced. It is defined in the Object class, so all classes inherit it. Subclass overwrites the finalize () method to sort system resources or perform other cleanup tasks. The finalize () method is called before the Garbage Collector deletes an object.
Second, can Anonymous Inner Class (Anonymous internal Class) be extends (inherited) other classes, or implements (implemented) interface (interface )?
An anonymous internal class is an internal class without a name. It cannot be extends (inherited) other classes, but an internal class can be used as an interface and implemented by another internal class.
Third, the difference between Static Nested Class and Inner Class is that the more you say, the better (the more general the interview questions are ).
Nested Class (generally C ++) and Inner Class (generally JAVA ). The biggest difference between Java internal classes and C ++ Nested classes is whether there are external references. See asp? Id = 704 & page = 1 "> http: // www.frontfree.net/articles/services/view.asp? Id = 704 & page = 1
Note: The static internal Class (Inner Class) means that 1 creates an object of the static internal Class and does not need an external Class object, 2. You cannot access an external class object from an object of a static internal class.
Fourth, the difference between & and.
& Is a bitwise operator. & Is a Boolean logical operator.
Fifth, the difference between HashMap and Hashtable.