1. The two objects have the same value (X. Equals (y) = true), but different hash codes are available, right? Why?
2. What is GC? Why does GC exist?
3. Could you briefly describe the hierarchy of Class Loader in J2EE applications?
4. Write a piece of code to implement the bank transfer function:
The interface is defined as follows:
Public interface itransfer {
/**
* For internal bank transfers, the transfer amount is deducted from the transfer-out account, and the transfer amount is added to the transfer-in account. The above two operations must be ensured.
* Either succeed at the same time or fail at the same time
* Fromaccountid: transfer out account
* Transfer outaccountid to the account
* Amount transfer amount
**/
Public void transferinner (string fromaccountid, string outaccountid,
Bigdecimal amount );
/**
* External transfer-transfer, deduct the transfer amount from the transfer account
* Fromaccountid: transfer out account
* Amount transfer amount
**/
Public void transferout (string fromaccountid, bigdecimal amount );
/**
* External transfer-transfer to add the transfer amount to the transfer account
* Transfer toaccountid to the account
* Amount transfer amount
Public void transerin (string toaccountid, bigdecimal amount );
}
Compile your implementation class to implement the above interface
Account table
Field: accountid, primary key varchar2 (32), user account
Field: amount, amount number)
5. "combination is better than inheritance". Do you agree to this sentence and describe your point of view.
6. Let's talk about the similarities and differences between the template mode and the Strategy Mode.