1. What is the life cycle of the servlet?
For:
First Request: Construction method->init (), service (), Doget ()/dopost ()
Subsequent requests: Service (), Doget ()/dopost ();
Servlets are single-instance .
2. Say Arraylist,vector, LinkedList storage performance and features HashMap and Hashtable differences
For:
ArrayList Vector: Storage by array, increase, delete slow, check, change fast
ArrayList: Thread is unsafe and fast.
Vector: Thread safe, slow (synchoronized Add ())
Likedlist: To double-linked list storage, increase, delete fast, check, change slow
HashMap and Hashtable both implement the map interface, Hashtable thread safety (Add,del-synchronized), HashMap thread is unsafe.
Outreach: What is thread safety and insecurity?
Thread Safety is a multi-threaded interview, using a lock mechanism. When a thread visits a data of that class, it is protected. Other threads cannot be interviewed until the thread has finished reading and other threads are available.
There is no data inconsistency or data contamination.
thread Insecurity is not providing data access protection. It is possible for multiple threads to change data successively causing the resulting data to be dirty data
3. What is a business? Four major features of a business? What does JDBC do with transactions?
For:
A transaction is a single logical unit of data manipulation. This unit may have multiple operations or be successful at the same time. To fail at a different time. Characteristics are atomicity, isolation, consistency, persistence.
JDBC Does transactional operations:
connection.setAutoCommit( false); connection.commit(); connection.rollback(); connection.setAutoCommit( true);
4. What are the differences between scope public, protected, private, and non-writable?
For:
Public declares a common member variable and a function member. Can be used outside of the class in the entire class.
Private member variables and function members are declared privately and are only available within the declared class.
Protected are declared as protected member variables and function members and are not available outside the class.
Can be used within a class.
Use in a class without using the keyword.
5. What is the IOC in spring?
What is di?
For:
IOC is control reversal, so-called inversion refers to the application itself is not responsible for the creation and maintenance of dependent objects, and this task to the third party is the spring to deal with, this is the right to create objects to the third party, control reversal is the transfer of control rights
di is a dependency injection. Dependency injection, the spring dynamically injects dependent objects into the component during execution.
When the IOC container is started. The container is responsible for creating all the objects within the container;
Forms the dependency between objects based on configuration information.
In other words, let the other person (IOC) serve you.
This is the core.
Five Java-related face questions per day (3)