1. The difference between overwrite and overload
overload is an overload that declares a property or method with the same name as an existing member, but parameter list differs from original member . Override is primarily used for method overrides between the parent and child classes, that is, the specified property or method can be overridden in a derived class with the same argument list requirements .
2. Class and Object differences
Seems to like to ask, for example, the class represents a computer, his basic properties include CPU, memory, input, and objects represent some type of computer, such as Dell, Lenovo, HP, Apple Computer. A class is a common, abstract, or object that is specific to something.
3, HashMap and Hashtable differences
1) HashMap Inherits the parent class Abstractmap,hashtable inherits the parent class dictionary
- public class hashtable
- extends dictionary
- implements map, cloneable, Java.io.Serializable
However HashMap is
- public class hashmap
- extends abstractmap
- implements map, cloneable, Serializable
2) HashMap Key/value can be empty, so thread is unsafe, key must be unique, value can not be unique; HashTable Key/value are not allowed to be empty, so threads are safe.
3) HashMap is not synchronized, while Hashtable is synchronous, multiple threads do not need to sync manually when accessing Hashtable, and HashMap need to provide external synchronization (COLLECTIONS.SYNCHRONIZEDMAP)
4 "hashtable The Hash/rehash algorithm used by HashMap is probably the same, so there is no big difference in performance.
4. Private default protected public scope
location Private default protected public
The same class Yes Yes Yes Yes
classes within the same package no Yes Yes Yes
subclasses in different packages no no no yes Yes
different packages and not subclasses no no no no Yes
To be continued in .....
Java common face question 2015 (continuous update ... )