1, the difference between HashMap and Hashtable:
The HashMap class is the implementation of a hash table-based MAP interface. It provides all the optional mapping operations and allows NULL values and NULL keys to be used. However, this class does not guarantee the order of the mappings, especially because it does not guarantee that the order is constant. The Hashtable class implements a hash table that maps the keys to the corresponding values. Any non-null object can be used as a key or a value. In the Java collection framework, some classes are thread-synchronized security classes, which are vectors, Hashtable, stacks, enumeration. The HashMap class is the implementation of a hash table-based MAP interface. It provides all the optional mapping operations and allows NULL values and NULL keys to be used. However, this class does not guarantee the order of the mappings, especially because it does not guarantee that the order is constant. The Hashtable class implements a hash table that maps the keys to the corresponding values. Any non-null object can be used as a key or a value. In addition, in the Java Collection framework, some classes are thread-synchronized security classes, which are vectors, Hashtable, stacks, enumeration.
2, Java.util.Random (). Nextint (10) +1), can be randomly to 9, so the output value may be 10.
3. Use the "+" operator to concatenate strings and int/double type data, and "+" to automatically convert int/double type data to string type. The int/double type data before the string type data is first calculated and then converted to string.
4, thread-safe methods are synchronous, only one access at a time, they are heavyweight objects, less efficient. For non-thread-safe classes and interfaces, programmers are required to handle thread-safety issues themselves in multi-threading.
5, the character length of each character is 1, the space character length is also 1, the English symbol character length is also 1.
Java Advanced Features