The maximum efficiency of the object group is still the traditional Array
Considering the efficiency, Java performs a boundary check at runtime.
The container class can only hold the reference, and the objects it holds are all object classes. The element type in the container is not fixed.
Array can generate an array that directly holds the basic type value. Therefore, array is divided into primitive array and object array.
Collection represents a group of independent elements, and map represents a group of key-value objects that are correct. The inheritance systems of the two represent different implementations.
You can compare the element size in a container by implementing comparable or comparator.
As for Vector... Not recommended
The basic philosophy of Java: poorly structuredProgramUnable to execute
Therefore, Java exception mechanism is available.
The type and contained information of the exception object are used to indicate error-related information.
Exceptions in Java all adopt the termination mechanism, that is, once an exception is generated, the entire program is terminated.
Writing your own exception classes must inherit from an existing exception type
In general, I/O in Java is a little too complicated and makes people suffer...
Let's write some typical applications.
1. input files with buffer function
Bufferedreader
2. Get input from memory
Stringreader
3. Get formatted input from memory
Datainputstream
4. output to file
Printwriter
5. Data Storage and recovery
Dataoutputstream
There are two other good functions: serialization and tokenizing.
Rtti (Run time type identification)
The traditional mechanism assumes that you have all type information during the compilation and execution phases.
The reflection mechanism allows you to find information related to the class during execution.