<> One , Before the interview
3-21 Resume delivered , Yes 3-27 Ali's written test
, There are only two algorithmic problems , Only one percent of the first question has been completed 60, Mind blowing , The second question is not written at all , I didn't expect to get into the interview . I forgot the written test ...... This morning, I was in charge of the railway , suddenly , I got an interview call all of a sudden , Make an appointment with me for an interview .( The intention is to refuse , Because I don't think I can get in , But I still want to learn ） The offer was due next week , But he said the interview was closed today . ok , I didn't give any hope , It's about three o'clock in the afternoon .
<> Two , Interview questions
1, Introduce yourself according to the tradition .
answer ： Hello! , I am ......（ The voice did not tremble and tense at the first interview ）
2, Tell me about your project .（ what the fuck , Come up and talk about projects ）
answer ： The first wechat app on campus portal 《 Fingertip removal 》. It covers the basic needs of teachers and students , For example, look up the timetable , Check the results , Confession wall , Electricity meter inquiry, etc ...（ Blow it , ha-ha ）
3, Your role in development ? And how the project was designed ?（ I like this kind of subjective question most ）
answer ： Back end developers , Write interface . The front and rear ends of the project are completely separated , The form of modular development , Each function corresponds to a module . The whole project is designed by , front end , back-end Three parts complete .
4, Does the interface do any verification ?（ I didn't think of any other verification .... my ）
answer ： According to the student number or teacher's job number to generate the corresponding sfm and jym, When an interface is requested sfm and jym To get the identity .
5,gc Do you understand the algorithm ? What are there ?（ The answer is quite complete , After all, it has been prepared many times , I feel like I can carry my back ）
sign - Clearing algorithm ： The algorithm is divided into two stages: marking and clearing . Marking is the stage of marking all active objects ; Cleanup is the stage of reclaiming objects that are not marked .
Replication algorithm ： That is, the memory space is divided into two blocks according to the capacity . When this piece of memory runs out , Copy the existing object to another piece , Then clean up the used one at a time . This makes it possible to reclaim half of the memory every time . Memory allocation does not need to consider the complexity of memory fragmentation , Just move the pointer at the top of the heap , Allocate memory in order , Easy to implement , Efficient operation .
sign - Sorting algorithm ： sign - The compression algorithm is suitable for the situation where there are many surviving objects , In the old days . It's marking - Based on the cleaning algorithm, some optimization is made . And mark - The cleaning algorithm is the same , sign - Compression algorithm also needs to start from the root node , Mark all reachable objects once ; But after that , It does not simply clean up unmarked objects , Instead, it compresses all living objects to one end of memory ; after , Clean up all spaces outside the boundary .
Generational collection algorithm ： This algorithm , The memory is divided into several blocks according to the life cycle of the object , New generation and old generation , In this way, the most appropriate collection algorithm can be adopted according to the characteristics of each era . This algorithm can be understood by focusing on the key points . The objects of the new generation live and die , Large number of objects , Just focus on this area , So it can greatly improve the efficiency of garbage collection . In addition, objects in the old age are stored for a long time , There is no need to scan the older generation frequently , Avoid scanning overhead .
6, What is the permanent generation ?( what the fuck , I studied it before , Forget it all ...... I just remember it was cancelled )
answer ：hotspot The method area is stored in the permanent generation , Therefore, the method area is called permanent generation . Permanent generation garbage collection mainly includes type unloading and waste constant pool recycling . When no object references a constant , The constant can be recycled . The unloading of types is more complex . Three points must be satisfied , All instances of this type are recycled , Of this type ClassLoader It's recycled , Corresponding to this type java.lang.Class It's not quoted anywhere , You can't instantiate an object anywhere by reflection
7,HashMap What is the data structure of the underlying implementation of ?（ Not a lot , Wait for him to ask . ha-ha ）
answer ：Java7 Medium HashMap( array + Linked list ),Java8 Medium HashMap( array + Linked list + Red and black trees )
8, When will it be transformed into red and black trees ? Why do you do this ?（ The answer is quite complete ）
answer ： When the element of the linked list is greater than or equal to 8 It will be converted to a red black tree . When the element of the linked list is greater than or equal to 8 Time , Query efficiency is reduced , At this time, it will become a red and black tree （ But it doesn't have to be transformed into red and black trees , In fact, it can be seen in the source code , Another criterion is that the size of the array is less than the default value 64, This will expand ）. When the red and black tree has only six nodes , The efficiency of the query is fairly good , But the insertion efficiency is improved , At this point, it will become a linked list .
9,HashMap When will the expansion be carried out ?（ The first answer is , When the element of the array exceeds the initial value, it will be expanded , The interviewer reminded the load factor , The answer is as follows ）
answer ： When hashmap The number of elements in exceeds the array size *loadFactor Time , The array will be expanded ,
10,HashCode What's the use （ I just thought about it HashMap Is the subscript of the array .）
answer ：（ There are no ideas in other aspects ）
11, Why is array size advocated 2 To the power of ?（ The answer was vague , The interviewer didn't ask ）
answer ： Because only the size is 2 To the power of , Can make hash value % n( Array size ) == (n-1) & hash The formula holds .
12 , Let's talk about it Spring Of Bean assembling （ Fortunately, I saw it the other day Spring At the bottom of .）
answer :1. stay XML For display configuration
2. use Java Code for display configuration
3. Implicit bean Discovery mechanism and automatic assembly
13,@Service and @Component The difference between （ I only know they are Spring Administration bean Components of )
answer ：( No idea )
14, I now have an interface , There are 5 Implementation classes , All implementation classes are added @Component annotation ,Spring Under management There will be a mistake , How to improve it ?( No idea )
repair ： How to understand java It's an explanatory language ?（ It's too basic , But I won't ......）
answer ：java It's an explanatory language , Because although java Also need to compile , Compiled into .class file , But machine language is not recognizable , It's bytecode , In the end, it is necessary
jvm An explanation of , Can be executed on various platforms , This is also true java Reasons for cross platform . So java It's an explanatory language .
15, Questioning session ： Give me some advice on my study （ The interviewer is very good , Give me suggestions and learning methods , I was also encouraged to deliver it to Ali again in my senior year ......）
answer ： We need to learn more about data structures , And the excellent idea of the framework .（ It's routine , But he patiently gave me advice for ten minutes , Still a little moved .） Let me prepare in two steps ： One is Java Basics , The other is to fight more , Think about the reasons when you use a framework ,“ Why? ” Very important .
<> Three , summary
It was the right decision not to refuse the interview , Especially the interviewer told me 10 Minutes of learning skills and suggestions , I feel like I've made it , Just looked at the state of the official website or in the interview , However, their performance can only be said to be much better than the last interview Tencent , But I don't feel like Ali , I can only say I'm looking forward to seeing you both , If there is no two sides, it should not be lost , Because I really learned a lot this time . Especially what the interviewer said : Software development must not be one-time development for permanent use . The same is true of learning , You can't learn something for an interview , Or the back , It would be meaningless , It's also a waste of time , When you really learn something , It must be for future use . I think back to learning some frameworks before , It's just a simple way to use it , The specific principle has not been really understood . In a way ： This is actually a kind of coping . Now it's time to make a plan and arrange it ...... In other words, the interviewer asked me to send it to Ali after my senior year （ ha-ha ...... Where did I get the courage !）.