An interview summary of a senior Java engineer, the real interview process and interview questions and answers

1. Interview skills

1. Memorize your resume

Reason: The first question in the interview is generally to give you a brief introduction to yourself, or to introduce your recent project, and an interviewer, if he can’t even know his resume, he’s got to know the project and technology mentioned in it. If you can’t describe it clearly, I don’t think any company will accept this. Even if you are a super talent, if you can’t express yourself, it’s probably a headache. So, remember: you must remember your resume and don’t ask you. Be able to write down everything, at least the two companies you have been with recently, the projects you have done in these two companies, the modules you are responsible for, the technologies used in the projects and the corresponding technical implementation schemes (this Particularly important).

Due to the length of the article, it is impossible to display all the interview questions in text form. This article has selected some interview questions for everyone. If you need this full version of the interview notes, you only need to obtain the interview information: Click here to receive!!! Password: CSDN
Insert picture description here

2. Deeply understand and memorize some basic Java knowledge

Reason: Most companies will ask a series of basic questions regardless of whether the interview is elementary or advanced, whether it is a written test or an interview. These basic questions probably include jvm, string, collection, thread, etc., if you say that each one makes you rote If you hardly memorize it, you can’t remember it, so it’s memorizing in understanding. Take jvm as an example. If you are asked to talk about your understanding of jvm, then you must first know what structure the JVM has and what each structure is used for , And then consider how a Java object is created to be recycled, how to approach these structures of the JVM. If you synthesize memory from these aspects, you believe that you will get twice the result with half the effort, and you will understand it more thoroughly.

As for if you are asked to talk about collections, for example, the difference between ArryList, LinkedList, Vector and other collections under List collection, then in the same way, you need to understand what the structure of each one is, so that you can know what it does, so that you can usually The usage will be more refined, and in the interview process, it will not be speechless.

3. Maintain self-confidence and a heavy and calm attitude

Reason: During the interview process, self-confidence is indispensable. I believe you can. On the way of the interview, you can say to yourself: I belive I can! Anyway, I do this, I suggest it in my heart. Actually, when facing the interviewer , Your self-confidence state will also make the interviewer feel that you are a very confident person, at least in the sense that it will give you a high score.

Another thing is to remain heavy and calm. If it is for you to provide technical solutions or talk about certain technical principles, there is no need to be nervous and grumble about everything. You can say to the interviewer: I will think about it first, and then assemble the memory myself The knowledge in the Chinese language, assembled the language, and spoke out in an orderly manner, so that you can better express your talents, right? Everyone will be nervous in an interview, and I will also be nervous. Sometimes I forget the knowledge points I remember, it doesn't matter, I boldly say I forgot, or I don't know. Remember, it doesn't matter if you don't know some parts. If you know all of them, then you should be at the CTO level (just kidding).

4. Try to remember that you cannot answer or have inappropriate questions during the interview

Reason: It’s okay if the interview fails. After all, the requirements of each company are different. The questions you ask may be different from what you are good at, but please remember one thing: during the interview, you can’t answer the questions, or you feel you can answer them. Write down the inaccurate questions yourself. If you can’t, you can ask the interviewer on the spot if he has a good answer. If the interviewer is unwilling to tell you (usually the basic aspect interviewer is too lazy to answer you), then you Just go home and check the information slowly. If it’s some specific technology, you can also write a case or something. After all, there are so many knowledge points, the questions are changing, and the principle remains the same. The interview is also a process of learning knowledge. You understand the technology that most companies currently need or require. I don't know this time, I will know next time.

5. Before going to the interview, it is best to understand the situation of the company you are going to interview

Reason: As the saying goes, know yourself and your opponent, and you will never end in battle. The interview is a battle. You need to understand the basic situation of the company you are interviewing, including job requirements, so that you can roughly know the technical requirements of the company you need to interview. Why do you want to understand the company’s main products and projects? It is to give you a general understanding of the company’s technical architecture, including that you may question and doubt one of their implementation methods. I believe the interviewer is very Willing to help you answer these questions. In this way, you have both shown performance and learned knowledge, so why not do it.

6. Arrange your interview time reasonably

Reason: It is estimated that many people do not understand this. Maybe most people are confused about how to arrange the interview time and arrange it at will. But here is a trick. If there are multiple interview opportunities at the same time, you put the company you most want to go to for the interview at the end, so that you have gone through the previous company screenings. If it succeeds, it is an opportunity. If it fails, It also pave the way for the last.

However, there are two points to consider here: 1. You need to remember the company and basic information of your resume (this means you are not from Haitou) 2. If you can’t remember, you can answer for a period of time first, and then learn about the company information. , Arrange with him via email or other means to adjust the interview time. And it is recommended to arrange no more than two companies for one day's interview, preferably one in the morning and one in the afternoon, so that you can have enough time to adjust your status.

2. Basic summary of interview questions

1. JVM structure principle and details of GC working mechanism

Answer: Specific reference: JVM structure and GC working mechanism are explained in detail. When it comes to GC, remember two points: 1. GC is responsible for reclaiming all memory spaces without any referenced objects. Note: Garbage collection reclaims the memory space occupied by objects without any reference rather than the object itself. 2. Two algorithms of the GC recovery mechanism, a, reference counting method b, reachability analysis algorithm (here, reachability, You can see the basic 2 Java object cycle), as for a more detailed introduction to the GC algorithm, you can refer to: Java GC mechanism algorithm.

2. The life cycle of Java objects

Answer: The creation phase, the application phase, the invisible phase, the unreachable phase, the collection phase, the final phase, the object space redistribution phase, etc., refer to the life cycle of Java objects.

3. The storage principle of Map or HashMap

Answer: HashMap is composed of a structure of array + linked list. For details, please refer to the realization principle of HashMap.

4. When the A and B fields in the data table are indexed together, will there be an index effect when using A alone or B alone? (How to use like query to have index effect)

Answer: When you look at the combination index of A and B, who is in the front and who is in the back. If A is in the front, then using A alone will have an indexing effect, and using B alone will not, and vice versa. In the same way, when using like fuzzy query, if only the preceding% is used, then there is an index effect, and if the double% sign is used for matching, then there is no index effect.

5. How to consider time zone conversion when storing date format in database?

Answer: Use TimeStamp, the reason is: the time zone conversion problem encountered in Java programming.

6. What methods are there in the JavaObject class?

Answer: What are the methods of Object.

7. HTTP protocol, the difference between GET and POST

Answer: Talk about the difference between GET and POST in HTTP.

Three, thread, design pattern, cache

1. SimpleDataFormat is not thread-safe, how to use it better and avoid risks?

Answer: About SimpleDateFormat safe time formatting thread safety issue.

2. How to look at design patterns and briefly talk about your understanding of the observer pattern

Answer: 1. Design patterns are used by magic horses. 2. Observer pattern class diagram and implementation.

3. How to share session in a cluster environment

Answer: 1. Session sharing of Java cluster 2. Session multi-server sharing solution. Another solution is to use a fixed server to keep the session exclusively and share it with other servers.

4. In a distributed and clustered environment, how to refresh the cache and how to keep it synchronized?

Answer: A. How to refresh the cache? 1. Regular refresh 2. Active refresh coverage. Each cache framework has its own refresh mechanism, or cache invalidation mechanism. Take Redis and Ehcache as examples. They have their own expiration mechanism. In addition, when refreshing and covering actively, Just get the corresponding key to overwrite the data.

B. How to keep the cache in sync? This redis has its own cluster synchronization mechanism, that is, the replication function. For details, refer to: Based on the implementation of Redis distributed cache, Ehcache also has the configuration of distributed cache synchronization. You only need to configure different server addresses. Refer to: Ehcache distributed cache synchronization.

5. How do you optimize a SQL execution for too long? In what ways?

Answer: 1. Check whether sql involves multiple tables or sub-queries. If so, see whether business splits can be carried out, related fields are redundant or merged into temporary tables (optimization of business and algorithms);

2. For queries involving linked lists, whether it is possible to perform sub-table query, and field integration for the results after single-table query;

3. If neither of the above two operations is possible and the linked list query is mandatory, then consider indexing the corresponding query conditions. Speed ​​up the query;

4. Separation of history tables for a large number of tables (such as transaction flow tables);

5. Database master-slave separation, read-write separation, to reduce the pressure of reading and writing for the same table at the same time. As for master-slave synchronization, MySQL has its own binlog to achieve master-slave synchronization;

6. Explain analyzes the sql statement, view the execution plan, analyze whether the index is used, analyze the number of scanned rows, etc.;

7. Check the mysql execution log to see if there are other problems;

Personal understanding: Fundamentally speaking, the slow query is that it takes up more memory in mysql, so you can consider it from this aspect.

Four, design plan related

The interview will also ask some questions about the design plan, such as:

1. Your interface service data was intercepted by someone. How do you prevent malicious submission of data?

Answer: We can set a service number in the interface transmission parameters, this number is used to distinguish whether to submit repeatedly. In this way, even if the data is captured, the other party cannot distinguish the meaning of each field. At this time, the function of this business number comes.

2. Assuming that the server is down frequently, what aspects do you troubleshoot?

Answer: I will leave this to the judges.

All in all, we still have to see what we should read, and we still have to learn what we need to learn. Again, the foundation is very important! Interview skills are also very important, or the same sentence: I hope you can find your favorite job~~

In addition, I advise everyone not to change jobs frequently. These knowledge points can be improved. Don't blindly switch jobs. It is tiring to find a job. And no company likes employees who frequently switch jobs.

5. What technologies should Java programmers learn when they change jobs?

Internet products and large enterprise-level projects often use:

1. Concurrent processing technology.

Specific to Java, it usually involves java.util.concurrent, concurrent locking mechanism, NIO, etc. Of course, the recently popular Netty framework can also be used as one of the alternatives for high concurrent processing, which requires Java’s thread scheduling mechanism Deeper understanding. However, these objects that may involve concurrency control (such as reentrantlock, etc.) can only exist in one JVM. Once the system is large enough to deploy multiple JVMs to handle concurrency, it is necessary to adopt a shared session technology (such as spring -session), or design the system backend as a stateless service as much as possible, which requires a deep understanding of RESTful.

2. High availability, load balancing technology.

Internet products and enterprise-level applications usually require Downtime within a year to be controlled within a small range. This requires sufficient high availability and load balancing architecture to support it. This generally has nothing to do with Java technology itself, but it is a It is a necessary technology for junior programmers to advance to senior programmers and even architects CIO, so you can properly understand the support of Nginx, HAProxy, etc. in this regard. In addition, the most "fashionable" approach now is to dockerize the application, with tools such as ETCD and kubernetes to achieve high availability and load balancing at the container level. Of course, this depends on actual needs. The most fashionable is not necessarily the most applicable. Consider the construction cost.

3. Cache technology.

Caching should be the eternal truth of improving response speed in large systems or under high concurrency conditions (Although I have seen articles with zero cache implemented by the big data processing technology used in Taobao's search product function, it can reach Taobao's volume And technical level is generally unlikely), there are too many tools in this area, ehcache, memcached, redis... From the perspective of Java, one needs to understand Java’s connector to these tools, and the other is the caching technology behind JSR-107 standard, you can refer to the implementation of spring-cache, read the source code to deepen your understanding.

4. Asynchronous processing technology.

This is usually one of the processing methods to counteract high concurrency. From the perspective of Java, the simplest asynchronous processing is to start an asynchronous thread. This also requires an understanding of Java thread scheduling. Of course, you can also use @ in Spring. Async and the like can also simply implement asynchronous thread processing. If it is a very resource-consuming business processing, simple asynchronous threads cannot meet the needs. This requires some message middleware to do these asynchronous processing. There are many message middleware, activemq, rabbitmq, kafka... Java's connector to these middleware. However, the most critical issue in asynchronous processing is the issue of transaction guarantees, which may require an understanding of the two-step transaction commit.

Guess you like

Origin blog.csdn.net/a3961401/article/details/108876710