1. Java Memory Model
Execution Engineer:java stack/pc registers/native|direct memory Area/java Heap/method Area
Volatile:thread = its own stack + memory cache inside CPU, volatile can make sure read/write directly to main memory data , not local CPU cache
2. Java GC
Serial GC Collector/parallel SCAVENGE/CONCURRENTMS/G1
Java heap:
New Generation/old Generation
New:eden+from/to survivor
Xmn=xmx, Survivorratio, Newratio
Copy/mark-sweep/mark-sweep-compact
Parallel new
Throughput First:
Prallel old
Response Time First:
Cms
3. Inner class and Static Inner class
Inner class contains a reference to their outer class, so it can access its Outers ' class member
Static inner class can only access static filed in it outer class, not require for outer class ' s instance to access Stati C Inner Class
4. Java constructor
123456 |
父类静态初始化块 子类静态初始化块 父类初始化块 父类构造函数 子类初始化块 子类构造函数 |
5. Collection (Wha ' ts the difference between List and Set)
The Java collection is a particularly useful tool class, broadly divided into: Set, list, and map three systems. Where set represents an unordered, non-repeatable set, the list represents an ordered, repeating set, and a map represents a set (key-value pair) that has a mapping relationship. After JDK 1.5, Java adds a queue system collection that represents a collection of queues implementation.
6. How JUnit (Setup/teardown) writes case, how to test exception
@Test (expected = org.springframework.dao.InvalidDataAccessApiUsageException.class)
7. Mock
@Beforepublic void SetUp () {context = new mockery ();/* need to consider security testing in service layer */securitycontex Tholder.getcontext (). Setauthentication (New Usernamepasswordauthenticationtoken ("Admin", "password")); Riskrankdao = Context.mock (Iriskrankdao.class); Context.checking (new Expectations () {{oneof (Riskrankdao). FindAll (); ReturnValue (list)); oneof (Riskrankdao). Save (Riskrank); would (ReturnValue (Riskrank));}); riskranksaved = Riskrankservice.save (Riskrank); context.assertissatisfied (); Assertsame ("riskRankSaved:" + Riskranksaved.tostring () + "Riskrank:" + riskrank.tostring (), Riskrank, riskranksaved);
8. Tdd/scrum
9. Java XML Read-write
DOM, dom4j, JDOM, SAX
Java HASHMAP Implementation & MAP interface
HashMap Internal Data storage:array + link (string/enum is also stored in array), key and its hashcode are used to get Val UE ' s storage index
Internal Stroage Data structure:entry:final key, value, Entry<key, value> Next, Final hashcode
Method:put/get/contains/putall/delete etc
Put:use hashcode to calculate hash value and index it to [0,array.length-1],if Array[i] was empty, point Array[i] to new A dded entry, increase map size; If Array[i] is isn't empty, check whether key exists in link, if yes, modify entry with new value, if not, set Array[i] to n EW added entry and set new added entry ' s next to previous entry, increase HashMap ' s size, if array ' s capacity exceeds it ' Capacity factor (initialized length * factor),resize length = 2 * length. Resize in the multi-threaded unprotected, not only will lead to put/get failure, but also beware of deadlock cycle
Remove:need to modify pervious entry ' s next if elements are not the first one in the link
The difference between Java HashMap and TreeMap
HashMap is faster than TreeMap (Red-black tree), TreeMap contains order
Linux Common commands
File Related:ls, DU/DF, Cat, VI
User Related:chown,chmod,useradd,groupadd
Network Related:tcpdump, Ifcfg,route,netstat
Others:top, Find,rpm,tar,grep, etc
JMS implementation, Queue, topic differences
Producer:destination.send (Message) destination:queue
Consumer Mdb:onmessage Queue
Queue:point to point (1-to-1)
Topic Publish/subscribe (1 to many)
Http://baike.baidu.com/subview/157103/12665866.htm?fr=aladdin
http://blog.csdn.net/cloud_ll/article/details/18228049
14.Spring Benefits
Inverse of control/dependency inject
What libraries are there in Core Java
NETWORK/IO|NIO|AIO/CONCURRENT/COLLECTION/SECURITY/JDBC etc
Synchronized.
Java synchronization, much slower than Java concurrent lock before 1.6, 1.6 slow 20%,1.7 and optimized
Synchronized is used to guarantee the exclusive access of multi-threaded, wait/notify to implement the thread communication, synchronzied lock object, lock is the CPU atomic lock
. SQL Inner/outer Join
Intersection/Set
SQL Statement Tuning
Pagination, some statement design is reasonable, join/like less use
Http://www.cnblogs.com/wxj1020/archive/2008/04/27/1173638.html
How to debug Java OOM
A. What kind of oom:stack? Method Area? Direct Memory Area? Heap area?
B. Heap Area:jmap or Heapdumponoutofmemoryerror | GUI:VISUALVM + Plugins
C. dump file Analysis:eclipse Memory Analyzer, check which class consumes big memories, check which object contains the C Lass
D. From code, check how the class objects is released, what ' s the problem
Record the Java interview technical issues I have encountered