3 Years of working experience Java What technical capabilities should a programmer possess , This may be Java What programmers care about . Let me explain , The following list is not a must , But the more you know , Final evaluation 、 It's bound to pay more .
1、 Basic grammar
This includes static、final、transient The role of keywords such as ,foreach Principle of circulation, etc . Today's interview I asked you static What are the key words use , If you answer static Modifying variables 、 I will think you are qualified , Answer static block , I'll think you're good , I'll think you're good , Answer the static guide bag and I will be very full of you It means , Because you can see that you are very keen on technology .
The deepest one , I remember the interviewer asked me directly Volatile Turn off The underlying implementation principle of key words ( By the way , Interview and being interviewed are relative , The interviewer can ask this question at the same time make the interviewer feel that he is also a person who likes to study technology , Added interviewers' right Company favors , I finally chose the company that asked this question ), Don't think it's too picky —- The simpler the problem is, the more you can see a person's level , Most people think about your technology in terms of depth 、 Second in breadth , Bear in mind .
It's very important , It's also a must . Basically List、Map、Set, What is asked is the underlying implementation principle of various implementation classes , Advantages and disadvantages of implementation classes .
What we need to master is ArrayList、LinkedList、Hashtable、HashMap、ConcurrentHashMap、 HashSet Implementation principle of , Can answer fluently , Of course I can CopyOnWrite Container and Queue No better . Say one more thing sentence ,ConcurrentHashMap I asked a lot of questions in the interview , Probably because this class can generate a lot of problems , About ConcurrentHashMap, I offer three answers or research directions to my friends ：
(1)ConcurrentHashMap Lock segment technology based on .
(2)ConcurrentHashMap Whether to lock the reading of , Why? .
(3)ConcurrentHashMap Is the iterator of strong consistency or weak consistency .
A cliche , Interview questions . In general, I will ask you about the framework used in your project , Then I'll give you some scenes and ask you how to use the frame , For example, I want to Spring initialization bean How to do something 、 Want to be in bean What to do when destroying 、MyBatis in $ and # And so on , These are more practical , Good accumulation at ordinary times 、 How to learn The details of the framework are not a problem .
If your questions are well answered , Interviewers often ask in-depth how the framework works . The most frequently asked question is Spring AOP Implementation principle of , Of course, this is very simple , In a couple of words , Even if you don't prepare for it . The most perverse thing I've ever met is let me draw it Spring Of Bean Factory reality Current UML chart , Of course, facing such a deep problem , I can't answer it /(ㄒoㄒ)/~~
The database will probably ask . Some basic images and all The difference between 、left join、 Several indexes and their differences will not be discussed , More important is the optimization of database performance , If you know nothing about database performance optimization , So there's time , I suggest you spend a day or two before the interview hold SQL Basis and SQL Prepare for the optimized content .
But don't worry about the database , A company often has many departments , If you are not familiar with the database and the basic technology is very good , Nine Chengdu will want you , I guess I'll put you in a department that doesn't require a very high level of database use first .
5、Web Some problems
Java Main orientation Web End , therefore Web Some of our questions are also necessary .
The two questions I've asked the most are ：
On Distributed Session Several ways to realize .
There are four kinds of answers that are often used to satisfy the interviewer .
Another frequently asked question is ： Let's talk about Session and Cookie The differences and connections between Session Implementation principle of . Besides these two questions ,web.xml The content is the key ,Filter、Servlet、Listener, Let's be clear about how they work , At least know their use . in addition , Some details like get/post The difference between 、forward/ Differences in redirection 、HTTPS The implementation principles of .
6、 Data structure and algorithm analysis
Data structure and algorithm analysis , For a programmer , It's better than not, and it's definitely useful at work . Array 、 Linked list is the foundation , Stacks and queues are deeper, but not hard , Trees are very important , Compare Important tree AVL Trees 、 Red and black trees , Can not understand their specific implementation , But you need to know what a binary search tree is 、 What is balance tree ,AVL The difference between tree and red black tree . Remember an interview , An interviewer and I talked about the index of the database , He asked me ： Do you know what kind of data structure is used for index ?
I got it Hash Watch bar. , answer incorrectly . He asked , Do you know why trees are used ? I replied because Hash Table may have more conflicts , In tens of millions or even hundreds of millions of levels of data front , It will greatly increase the time complexity of searching . And the trees are stable , It's guaranteed that you can find the data you want up to 20 or 30 times , They're not quite right , Finally, we talked about this issue , I see, too Why use trees , Don't say here , Why do netizens think index should be realized by tree ?
As for algorithm analysis , Can't 、 Don't want to study , Remember an interview when someone asked me ,Collections.sort Method what sort method is used , forehead , Spitting blood three litres . Of course. Show my erudition , There are also some research on Algorithm Analysis (⊙﹏⊙)b, I'd rather say something about bubble sorting . Of course not , Interested netizens and friends can have a look Collections.sort Source code for method , It's called TimSort Ranking method , That is, the enhanced merge sort method .
7、Java virtual machine
To my surprise ,Java Virtual machine should be a very important part , As a result, the probability of being asked in these companies is almost 0. Need to know , I spent a lot of time studying last year Java The virtual machine , Teacher Zhou Zhiming's 《 In depth understanding of Java virtual machine ：JVM Advanced features and best practices 》, I read it more than five times .
Get down to business , although Java Virtual machine didn't ask , But I think it's necessary to study it , Let me make a simple outline , Talk about Java More important content in virtual machine ：
(1)Java Memory layout of virtual machine
(2)GC Algorithms and garbage collectors
(3) Class loading mechanism , That's the parent delegation model
(4)Java Memory model
(5)happens-before The rules
(6)volatile Keyword usage rules
Maybe the interview is useless , But on the way to Daniel , No, No. .
8、 Design patterns
What I thought was very important , Only Alibaba B2B I was asked once during the interview of business department , It was the decorator mode .
Of course, we can't be so utilitarian , Study for an interview , Design pattern is still very important in work 、 Very useful ,23 Ten or so design patterns that are commonly used for key research , There are three main directions of Q & A about design pattern in interview ：
(1) What design patterns are used in your project , How to use .
(2) Know the advantages and disadvantages of common design patterns .
(3) Able to draw common design patterns UML chart .
That's a question to ask . Because of three years of work experience , So basically, I won't ask you how to implement multithreading , It's going to go deeper, for example Thread and Runnable Difference and connection of system 、 many times start What about a thread 、 What are the states of a thread . Of course, it's just basic , Unexpectedly , Several interviews almost all asked a question at the same time , Different ways of asking .
In summary That's what it means ：
If there is Thread1、Thread2、ThreaD3、Thread4 Statistics of four threads C、D、E、F Size of four disks , All threads are counted and handed over to Thread5 Thread to do summary , How to realize ?
Do smart netizens have an answer to this question ? It's not hard to ,java.util.concurrent There are ready-made classes to use .
in addition , Thread pool is also a common question , There are several common thread pools ? What are the differences and connections between these thread pools ? What is the implementation principle of thread pool ? More practical , It will give you some specific scenes , Let you answer what kind of thread pool is suitable for this scenario .
Last , Although the interview didn't ask much , But multithreaded synchronization 、 Lock is also the key .synchronized and ReentrantLock The difference between 、 synchronized Lock common method and lock static method 、 The principle and troubleshooting of deadlock .
10、JDK Source code
To get a high salary ,JDK Source code is not unreadable . The above content may also be related to specific scenarios ,JDK Source code is to see whether you usually like to study . I was asked during the interview no Less JDK Source code problems , One of the trickiest asked me ,String Of hashCode() How is the method implemented , Fortunately, I usually String See a lot of source code , A big answer. General .
JDK In fact, the source code has nothing to summarize , Just look at the individual , Summarize the important source code ：
(1)List、Map、Set Source code of implementation class
(2)ReentrantLock、AQS Source code
(3)AtomicInteger Implementation principle of , Mainly clear CAS Mechanism and AtomicInteger How to use CAS Realized by mechanism
(4) Implementation principle of thread pool
(5)Object Methods in classes and the role of each method
These are really demanding , I spent the whole year last year basically turning JDK The source code of the important classes in , It really takes time 、 Expend energy , Of course, look back , it is worth that —- Not just for interviews .
Last , If you are interested, if you have time , Suggested learning 、 Look at the SOA and RPC, Service Oriented Architecture , Necessary for large distributed architecture , Life-saving recipe 、 Cure all diseases 、 To test that .
Each stage should have a goal for each phase , No matter in life , Study or work , We all need to set goals , Only in this way can we have direction and motivation ; And do things with rhythm , Don't mess up . If you don't set goals , You feel like you don't know what to do every day ; I don't know what to do first , What to do after ; People also feel lazy .
If you think the content of this article is helpful to you , You can pay attention to me , In addition, I would like to recommend one to you java Communication and learning group ： 3907814, It will share some videos from zero foundation to senior architects ： Yes Spring,MyBatis,Netty Source code analysis , High concurrency 、 High performance 、 Distributed 、 Principles of microservice architecture ,JVM Performance optimization these become the necessary knowledge system for Architects . You can also get free learning resources , The brain maps listed in this article are also shared and sorted out from the group .