Java Interview Record

Insert picture description here

  1. Don't make people feel that you only copy other people's code
  2. Is the stand-alone version enough? Appropriate understanding of distributed
  3. Regarding the database, don’t just know about adding, deleting, modifying and checking, but you have to understand performance optimization
  4. Java core aspects, prepare interview questions around data structure and performance optimization
  5. For Linux, at least know how to look at logs to troubleshoot problems
  6. Read through a piece of low-level code as a bonus item
  7. All in all, embed the above skills into the projects you have done

Summary: This article describes more ways to prepare for an interview

1. Don't make people feel that you only copy other people's code

The framework is the focus, but don't make people feel that you can only copy other people's code! Before the interview, the interviewer will generally read the resume to check the candidate's project experience in the framework. During the candidate's project introduction, the interviewer will also focus on the candidate's recent framework experience. At present, the most popular one is SSM.

However, candidates who generally work within 5 years are mostly only able to "copy" other people's code, which means that they can expand new functional modules based on the existing framework and follow the process written by others. For example, if you want to write a functional module for a stock pending order, you will imitate the existing ordering process, and then from the front end to the back end to the database, write it in the same way, and change the code points related to the function at most.

In fact, every one of us came here like this, but in the interview, if you only show this ability, you will be at the same level as most people. At this point, you will not be able to show your advantage.

We know that if you simply use the SSM framework, most projects will have pain points. For example, the database performance is poor, or the business module is more complicated, and the amount of concurrency is relatively high. The Controller in Spring MVC cannot meet the needs of jumping. So during my interview, the interviewer also asked a question: In addition to writing business code in accordance with the existing framework, what changes have you made?

My answer is: Redis cache has been added to avoid frequent calls to some constant data. Or, in MyBitas xml, the select statement where condition has isnull, that is, if this value is present, a where condition is added. For this, a query condition without isnull is added to any where to prevent the statement from being passed in as a parameter. When it is null, perform a full table scan. Or, to put it simply, the back-end asynchronously returns a large amount of data and takes a long time. In the project, I increased the maximum asynchronous return time, or compressed the returned information to increase network transmission performance.

For this question, in fact, most interviewers don't care what answers they hear, they only care that the answers are not logical. Generally, as long as the answer is correct, the interviewer will give a judgement of "have one's own experience and a certain understanding at the framework level", otherwise, they will only give "the framework code can only be written under the leadership of the project manager, and does not understand the framework itself." many".

In fact, when preparing for an interview, it is not difficult to summarize the main points in the framework. I don't believe that everyone has accumulated nothing when doing projects. As long as you say it, you can say that you have crushed nearly 70% of the competition in this regard. By.

2. Is the stand-alone version sufficient? Appropriate understanding of distributed

Don't just look at the stand-alone version of the framework, understand some distributed! In addition, when describing the framework technology in the project, it is best that you bring some distributed technology. Below I list some distributed technologies that you can prepare.

1. In terms of reverse proxy, the basic configuration of nginx, such as how to set rules through the lua language, and how to set session stickiness. If you can, look at the underlying nginx, such as protocol, cluster settings, failover, etc.

2. In terms of remotely calling dubbo, you can look at the knowledge points of dubbo and zookeeper integration, and then take a deeper step to understand the underlying transmission protocol and serialization method of dubbo.

3. In terms of message queues, you can look at the use of Kafka or any of the components. To make it simple, you can look at the configuration and working group settings. If you go deeper, you can look at the Kafka cluster, the persistence method, and how to send messages. Use long connections or short intercepts.

The above is just an example with 3 components. You can also look at Redis cache, log framework, MyCAT sub-database and table, etc. There are two types of preparation methods. The first is to know how to use it. This is relatively simple. It can be built into a functional module through the configuration file. The second is to read some low-level code appropriately to understand the protocol and cluster. Advanced knowledge points such as failover and failover. A summary of the most complete Redis high-availability solution in history.

If you can talk about the bottom layer of distributed components in the interview, you will get better evaluations, such as "understanding the bottom layer of the framework" or "experienced in the framework", so you can even go to the interview with the architect. Not to mention advanced development.

3. Regarding the database, don’t just know about adding, deleting, modifying, checking, but knowing about performance optimization

Regarding the database, don't just know about adding, deleting, modifying, checking, but knowing about performance optimization! In actual projects, most programmers may only use additions, deletions, modifications, and checking. This situation is more common when we use Mybatis. However, if you also behave like this during the interview, it is estimated that your ability is about the same as that of other competitors.

In this regard, you can prepare the following skills:
1. Advanced SQL, such as group by, having, left join, subquery (with in), row to column and other advanced usage.

2. In terms of table building, you can consider whether your project uses the three-paradigm or the anti-paradigm. What are the reasons?

3. Especially for optimization, you can prepare how to view the improvement points of SQL statements through the execution plan, or other ways to improve SQL performance (such as indexing, etc.).

4. If you feel capable, you can also prepare some MySQL cluster, MyCAT sub-database and sub-table skills. For example, through LVS+Keepalived to achieve MySQL load balancing, MyCAT configuration. Similarly, if you can, also look at some related low-level code.

Even if your performance in the first three points is average, you can at least surpass nearly average candidates. Especially when you perform very well in SQL optimization, then when you interview for advanced development, the database level must be up to the standard. The answer to four points is very good, then congratulations, your ability in the database has even reached the level of the primary architecture.

4. Java core aspects, prepare interview questions around data structure and performance optimization

At the core of Java, prepare interview questions around data structure and performance optimization! There are many interview questions on the Java core, but in addition, you should also focus on the collection (ie data structure) and multithreaded concurrency. On this basis, you can prepare some design patterns and virtual machines. The rhetoric.

Here are some of the questions I usually ask:

  • String a = "123"; String b =
    "123"; What is the result of a==b? This includes many knowledge points such as memory and String storage.
  • When do the hashcode and equal methods in HashMap need to be rewritten? What are the consequences if you don't rewrite it? In this regard, you can learn more about the underlying implementation of HashMap (or even ConcurrentHashMap).
  • What is the difference between the underlying implementation of ArrayList and LinkedList? Which occasions are they suitable for? In this regard, you can also understand the relevant underlying code.
  • What is the function of the volatile keyword? From this, everyone can understand the difference between thread memory and heap memory. volatile keyword analysis.
  • CompletableFuture, this is a new feature in JDK1.8, how to realize multi-thread concurrency control through it?
  • In the JVM, which area is the new object in? Go deeper and ask how to view and optimize the memory of the JVM virtual machine.
    What is the difference between Java's static proxy and dynamic proxy? It is best to combine the underlying code.

Through the above question points, in fact, we will find that not only stay at the "useful" level, the interviewer of the big factory will not ask how to put elements in the ArrayList. As you can see, the above questions include details such as "multi-threaded concurrency", "JVM optimization", and "low-level code of data structure objects". You can also draw inferences from one another and prepare more similar interview questions by looking at some advanced knowledge.

We know that the current Java development is based on the Web framework, so why do we need to ask about the core knowledge of Java? I know it firsthand. 21 Java core technologies you must master!

Before in my team, I met two people, one is good at work, the specific performance is to use the basic API of Java core, and there is no willingness to understand in depth (I don’t know how to understand in depth), and the other Usually I will look at some advanced knowledge of Java concurrency, virtual machine, etc.

After half a year, the latter's ability was quickly upgraded to advanced development. Because of the thorough understanding of the core knowledge of JAVA, there is no major problem with the low-level implementation of some distributed components. The former has been repetitive work, and the ability has only remained at the level of "being able to work."

In a real interview, if you are not familiar with the core knowledge of Java, it is estimated that it will be difficult to advance to advanced development, let alone interview for an architect-level position.

5. For Linux, at least know how to look at logs to troubleshoot problems

For Linux, at least know how to look at the log to troubleshoot problems! If a candidate can prove that he has the ability to "solve problems" and "solve problems", this is definitely a plus point, but how to prove it?

At present, most of the Internet projects are deployed on Linux, that is to say, the logs are all on Linux, and some actual Linux operations are summarized below. Common Linux commands that Java programmers must master.

  1. You can open the file with the less command, reach the bottom of the file with Shift+G, and then use ?+keywords to search for information based on the key.
  2. You can search keywords by grep. The specific usage is grep keyword file name. If you want to search the results twice, use grep keyword 1 file name keyword 2
    -color. Finally -color is the highlighting keyword.
  3. Can edit files through vi.
  4. File permissions can be set through chmod.

Of course, there are more practical Linux commands, but in the actual interview process, many candidates did not even know a Linux command. Still this sentence, even if you know something very basic, you are better than the average person.

6. Read through a piece of low-level code as a bonus item.
How can I prove that I have a good understanding of a knowledge point? It can be explained by the underlying code. When I communicate with many programmers who have work experience within 5 years, many people think this is difficult? Indeed, if you want to understand distributed components by reading the underlying code, it is not that difficult, but if the underlying code of the following part is not difficult to understand.

  1. The underlying code of ArrayList and LinkedList contains implementation methods based on arrays and linked lists. If you can explain clearly the expansion, "traversal through enumerator" and other methods, you can definitely prove yourself.
  2. HashMap directly corresponds to the data structure of Hash table. In the underlying code of HashMap, it contains operations such as put and get of hashcode, and even in ConcurrentHashMap, it also contains the logic of Lock. I believe that if you look at the ConcurrentHashMap during the interview, and then combine it with talking and drawing on the paper, you will surely conquer the interviewer.
  3. You can look at the implementation of static proxy and dynamic proxy, and then go deeper, you can look at the implementation code in Spring AOP. Explain the three proxy modes in Java in detail.
  4. Perhaps the underlying implementation code of Spirng IOC and MVC is hard to understand, but you can talk about some key classes and how to implement them according to the key process.

In fact, the preparation of the underlying code is not necessary, and it is not limited to any aspect, such as the TreeSet based on the red-black tree in the collection, the open source framework based on NIO, and even the Dubbo of distributed components can be prepared. And it is not necessary to recite all the underlying layers when preparing (in fact, it is difficult to do), as long as you can combine some important classes and methods, and clarify your ideas (for example, explain clearly how HashMap can quickly locate through hashCode).

So in the interview, how do you find a good opportunity to tell the above-mentioned low-level code that you have prepared? In the interview, you will always be asked about collections, Spring MVC framework and other related knowledge points. When you answer, by the way, "I still understand the underlying implementation of this piece", then the interviewer will definitely ask, then you can Speak up.

Don’t underestimate this help to candidates. Once you talk about it, as long as the meaning is in place, you can at least get a "proactive and professional" evaluation. If the description is clear, then the evaluation will be upgraded to "familiar with Java core skills (or Spring MVC), and the basic skills are solid".

You know, in the interview, few people can explain the underlying code clearly, so you throw out this topic, even if the expected results are not achieved in the end, the interviewer will not lower your evaluation. Therefore, preparing this piece is definitely a "profitable but not harmful" business for making money.

7. All in all, embed the above skills into the projects you have done

All in all, embed the above skills into the projects you have done! During the interview process, many candidates spoke very well on SQL optimization skills, but finally learned that they were mastered during his self-study and were not used in actual projects.

Of course, this is better than nothing, so I will write "I have taught myself SQL optimization skills" in the interview, but if I have practiced it in the project, then I will write "I have practical database SQL optimization skills". You can compare the differences between the two. One is more theoretical, and the other is directly capable of doing things. In fact, in many scenarios, I don't believe that SQL optimization skills must have not been practiced in actual projects.

From this case, what I want to tell everyone is that the many skills and rhetoric that you have spent a lot of hard work (in fact, the method direction is obtained, it does not take too much energy) to prepare, should finally be implemented in your actual project.

For example, if you have the experience of querying keywords in the Linux log to troubleshoot problems, you can bring a sentence when you describe it. I did it in the previous project. For another example, by looking at the underlying code, you understand the difference between TreeSet and HashSet and their scope of application, then you can recall the project you did before. Is there a scenario that only applies to TreeSet?

If so, then you can properly describe the needs of the project, and then say that by reading the underlying code, I understand the difference between the two, and in this actual demand, I used TreeSet, and I also made a special comparison Sex test found that using TreeSet is xx percentage points higher than HashSet.

Please remember that "practical experience" must be more valuable than "theoretical experience", and most of the theoretical experience you know must have been used in your project. So, if you just make the interviewer feel that you only have "theoretical experience", then it's a shame.

Summary: This article describes more ways to prepare for an interview

This article does not give many interview questions, but this article does not intend to give too many interview questions. From this article, what everyone sees more is the pain points of many candidates discovered by interviewers.

The intention of this article is to let everyone stop repeating the mistakes of others, which is not to be counted. This article also gives a lot of ways to prepare for interviews. Your abilities may be superior to others, but if you prepare for the interview in the same way as others, or use your work in the project as an example, without summarizing the highlights of your project, then the interviewer is really good Will look down upon you.

Guess you like

Origin blog.csdn.net/zhangzhanbin/article/details/110938314