Preface
Recently, I have seen that many friends are worrying about interviews, so I have summarized some interview experiences, hoping to help everyone.
What are you asking in an interview?
First of all, you need to know that the interviewer’s questions are closely related to the content written on your resume, so you must know the skills written on your resume.
General interviews include the following types of knowledge:
Java foundation, multithreading, IO and NIO, virtual machine, design pattern
Data structure and algorithm (the ability to write algorithms is required)
Computer network (TCP three-way handshake and four waved hands)
Data communication (RESTful, RPC, message queue)
Operating system (basic commands and usage of Linux)
Mainstream framework (the underlying principles and source code of Spring ask a lot)
Data storage (most common is MySQL, Redis)
distributed
other problems:
Actual scene problem
Life issues
Personality/other issues
2. Knowledge points frequently asked in interviews
1) Set related questions (must ask)
The underlying implementation of HashMap, LinkedHashMap, ConcurrentHashMap, ArrayList, LinkedList
The difference between HashMap and Hashtable
The difference between ArrayList, LinkedList, Vector
The difference between HashMap and ConcurrentHashMap
The difference between HashMap and LinkedHashMap
Is HashMap thread safe
How does ConcurrentHashMap achieve thread safety
Why the length of HashMap is a power of 2
2) Multi-threaded concurrency related issues (must ask)
3 ways to create threads
What is thread safety
The difference between Runnable interface and Callable interface
The difference between wait method and sleep method
synchronized、Lock、ReentrantLock、ReadWriteLock
Introduce CAS (lock-free technology), what is pessimistic lock and optimistic lock
The role and principle of the volatile keyword
What is ThreadLocal
4 ways to create a thread pool
The internal working principle of ThreadPoolExecutor
How to ensure thread safety in a distributed environment
The difference between synchronized and lock and the difference between volatile and synchronized
3) JVM related issues
Introduce the garbage collection mechanism (when, what, what was done).
What are the garbage collection algorithms and their characteristics.
The process of class loading.
Parent delegation model.
What class loaders are there.
Can you write a class called java.lang.String by yourself?
4) Questions about design patterns (must ask)
The most common design pattern is to let you write a singleton pattern by hand (note the several different implementation methods of the singleton pattern) or let you talk about how a common design pattern is used in your project.
In addition, the interviewer may also ask you questions such as the difference between the abstract factory and the factory method pattern, and the idea of the factory pattern.
It is recommended to take a good look at the agent model, observer model, and (abstract) factory model . These three design patterns are very useful.
5) Database related questions, for MySQL (must ask)
Let you write SQL by hand for the topic.
Have SQL optimization experience.
The data structure of the MySQL index.
How to optimize SQL.
The execution order of SQL keywords.
What kinds of indexes are there.
When should (and should not) build an index.
Explain which columns are included.
6) Framework related issues
The difference between Hibernate and Mybatis.
The difference between Spring MVC and Struts2.
What design patterns does Spring use.
What AOP is mainly used for in Spring.
The way Spring injects beans.
What is IOC and what is dependency injection.
Is Spring single or multiple, and how to modify it.
Spring transaction isolation level and propagation.
Introduce the cache mechanism of Mybatis/Hibernate.
The difference between # and $ in the mapper file of Mybatis.
The difference between resultType and resultMap in the mapper file of Mybatis.
7) Other issues
Introduce lower stack and queue.
The difference between IO and NIO.
The difference between interface and abstract class.
Issues related to automatic unboxing/boxing of int and Integer.
Constant pool related issues.
The difference between == and equals.
What is JDK? What is JRE? What is JVM? The connection and difference between the three
The difference between Java and C++
The difference between overloading and rewriting.
The difference between String and StringBuilder and StringBuffer.
Are static variables, instance variables, and local variables thread safe, and why?
Which one is executed when try, catch, and finally have a return statement.
Introduce B-tree and binary tree.
Implementation of distributed locks.
Distributed session storage solution.
Commonly used linux commands.
3. Other experience sharing
**1)** Don't go to the company you want to go to at the beginning. Think of the interview as a technical exchange. The more interviews you have, the more experience you have. After you get your experience, you can invest in the ideal company.
**2) **Don't actively mention unfamiliar technologies.
**3)** If you don’t understand the interviewer’s question, don’t pretend to understand it. You can politely ask the other person to repeat it and give yourself more time to think.
**4)** During the interview days, keep learning every day, whether it is learning new things or reviewing old things.
**5)** If you have not got the result for more than 3-5 days, and you really want to go to this company, you can take the initiative to contact HR to ask about the result of the interview. Even if the interview fails, you can also ask the reason for the failure of the interview and sum up the experience. .