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 access, with a locking mechanism, when a thread accesses one of the class's data, protection, other threads can not access until the thread is finished reading, other threads are available. There is no data inconsistency or data contamination.
thread Insecurity is not providing data access protection, it is possible to have multiple threads change data successively causing the resulting data to be dirty data
3. What is a business? Four major features of a business? How does JDBC do transactional processing?
For:
A transaction is a single logical unit of data manipulation, which may have multiple operations, succeed at the same time, or fail at the same time, characterized by atomicity, isolation, consistency, and 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:
|
class Internal |
This package |
sub-class |
External Package |
Public |
√ |
√ |
√ |
√ |
Protected |
√ |
√ |
√ |
X |
Default |
√ |
√ |
X |
X |
Private |
√ |
X |
X |
X |
5. What is 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 the run.
When the IOC container is started, the container is responsible for creating all objects within the container;
The dependency between objects is formed according to the configuration information;
In other words, let the other person (IOC) serve you. This is the core.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Five questions per day (with notes)