After interviewing Ali and Meituan, I summarized the real questions and analysis of the interviews frequently asked by big companies: java collection + spring + design pattern + concurrent programming + MyBatis, etc. (998 channels)

I don’t know if the interviews are going well recently, and whether they will often be asked some unfamiliar questions. I don’t know how to answer these questions. Today I have compiled some real interview questions and analysis that Dachang frequently asked in 2020. , The content points include java collections, jvm, concurrent programming, spring, mybatis, springMVC, microservices, Dubbo, netty, network, zookeeper, kafka, rabbitMQ, readis cache, database, design patterns, etc. Real interview questions.

* Data acquisition channel: click here for direct access to the advanced channel .

22 real Java collection interview questions:

  1. The difference between ArrayList and Vector.
  2. Talk about the storage performance and characteristics of ArrayList, Vector, LinkedList.
  3. What is the difference between fail-fast and fail-safe?
  4. The data structure of hashmap.
  5. How does HashMap work?
  6. When will Hashmap expand?
  7. What are the characteristics of the three interfaces of List, Map, and Set when accessing elements?
  8. The elements in the Set cannot be repeated, so what method is used to distinguish whether it is repeated or not? Is it to use == or equals()? What is the difference between them?
  9. Two objects have the same value (x.equals(y) == true), but they can have different hashcodes. Is this sentence correct?
  10. What is the difference between heap and stack.
  11. What are the basic interfaces of the Java collection framework?
  12. What is the difference between HashSet and TreeSet?
  13. What is the underlying implementation of HashSet?
  14. The realization principle of LinkedHashMap?
  15. Why does the collection class not implement the Cloneable and Serializable interfaces?
  16. What is iterator (Iterator)?
  17. What is the difference between Iterator and ListIterator?
  18. What is the difference between Array and ArrayList? When should I use Array instead of ArrayList?
  19. What are the best practices for the Java collection framework?
  20. The elements in the set cannot be repeated, so what method is used to distinguish whether it is repeated or not? Should I use == or equals()? What is the difference between them?
  21. What are the Comparable and Comparator interfaces? List their differences.
  22. The difference between Collection and Collections.

image

21 real JVM interview questions:

  1. Java class loading process?
  2. Describe the principle mechanism of JVM loading Class files?
  3. Java memory allocation.
  4. What is GC? Why is there a GC?
  5. Briefly describe the Java garbage collection mechanism.
  6. How to judge whether an object is alive? (Or how to determine the GC object)
  7. The advantages and principles of garbage collection. And consider two recycling mechanisms.
  8. What is the basic principle of the garbage collector? Can the garbage collector reclaim memory immediately? Is there any way to proactively notify the virtual machine for garbage collection?
  9. Will there be a memory leak in Java? Please describe briefly.
  10. Deep copy and shallow copy.
  11. What will System.gc() and Runtime.gc() do?
  12. When is the finalize() method called? What is the purpose of finalization?
  13. If the object's reference is set to null, will the garbage collector immediately release the memory occupied by the object?
  14. What is distributed garbage collection (DGC)? How does it work?
  15. What is the difference between a serial collector and a throughput collector?
  16. In Java, when can an object be garbage collected?
  17. Description of Java memory allocation and reuse collection policy rates and Minor GC and Major GC.
  18. Will garbage collection occur in the permanent generation of the JVM?
  19. What are the methods of garbage collection in Java?
  20. What are class loaders and what are the class loaders?
  21. The class loader parent delegation model mechanism?

image

38 real questions in concurrent programming interviews:

Synchronized related questions:

  • Have you ever used Synchronized and what is its principle?
  • You just mentioned acquiring a lock on an object. What exactly is this "lock"? How to determine the lock of an object?
  • What is reentrancy, and why is Synchronized a reentrant lock?
  • What optimizations does the JVM make to Java's native locks ?
  • Why is Synchronized an unfair lock?
  • What is lock elimination and lock coarsening?
  • Why is Synchronized a pessimistic lock? What is the realization principle of optimistic locking? What is CAS and what are its characteristics?
  • Is optimistic locking necessarily good?

ReentrantLock ReentrantLock and other explicit lock related issues:

  • Compared with Synchronized, what is the difference in the implementation principle of the reentrant lock ReentrantLock?
  • So please talk about the AQS framework?
  • Please compare the similarities and differences between Synchronized and ReentrantLock in as much detail as possible.
  • How does ReentrantLock achieve reentrancy ?
  • In addition to ReetrantLock, which concurrency tools in JUC have you been exposed to?
  • Please talk about ReadWriteLock and StampedLock.
  • How to synchronize the threads of Java with each other? What synchronizers do you know about? Please introduce them separately.
  • CyclicBarrier and CountDownLatch look very similar, please compare?

Java thread pool related issues:

  • How is the thread pool implemented in Java?
  • Several core construction parameters for creating a thread pool?
  • How are the threads in the thread pool created? Was it created at the beginning with the start of the thread pool?
  • Since it is mentioned that different thread pools can be created by configuring different parameters, what thread pools are implemented by default in Java? Please compare their similarities and differences.
  • How to submit threads in the Java thread pool?

Java memory model related issues:

  • What is Java's memory model, and how do threads in Java see each other's variables?
  • Please talk about the characteristics of volatile and why it can guarantee the visibility of variables to all threads?
  • Since volatile can guarantee the visibility of variables between threads, does it mean that operations based on volatile variables are concurrently safe?
  • Please compare the similarities and differences between volatile and Synchronized.
  • Please talk about how ThreadLocal solves concurrency safety?
  • Many people say that ThreadLocal should be used with caution. Talk about your understanding, what should be paid attention to when using ThreadLocal?

image

25 real Spring interview questions:

  • What is the Spring framework? What are the main modules of the Spring framework?
  • What are the benefits of using the Spring framework?
  • What is Inversion of Control (IOC)? What is dependency injection?
  • Please explain the IoC in the Spring framework?
  • What is the difference between BeanFactory and ApplicationContext?
  • How many ways to configure Spring?
  • How to configure Spring based on XML configuration?
  • How to configure Spring based on Java configuration?
  • How to configure Spring with annotations?
  • Please explain the life cycle of Spring Bean?
  • What is the difference between the scope of Spring Bean?
  • What are Spring inner beans?
  • Are singleton beans in the Spring framework thread-safe?
  • Please give an example of how to inject a Java Collection in Spring?
  • How to inject a Java.util.Properties into Spring Bean?
  • Please explain the automatic wiring of Spring Bean?
  • Please explain the difference in auto-assembly mode?
  • How to turn on annotation-based automatic assembly?
  • Please give an example to explain the @Required annotation?
  • Please give an example to explain the @Autowired annotation?
  • What is the difference between constructor injection and set value injection?
  • What are the different types of events in the Spring framework?
  • What is the difference between FileSystemResource and ClassPathResource?
  • What design patterns are used in the Spring framework?

image

24 real questions for MyBatis interview:

  • What is Mybatis?

  • Advantages of Mybaits:

  • Disadvantages of the MyBatis framework:

  • Applicable occasions of MyBatis framework:

  • What is the difference between MyBatis and Hibernate?

  • What is the difference between #{} and ${}?

  • What should I do when the attribute name in the entity class is different from the field name in the table?

  • How to write like statement in fuzzy query?

  • Usually an Xml mapping file will have a Dao interface corresponding to it. What is the working principle of this Dao interface? When the parameters of the methods in the Dao interface are different, can the methods be overloaded?

  • How does Mybatis pagination? What is the principle of the paging plug-in?

  • How does Mybatis encapsulate the sql execution result as a target object and return it? What are the mapping forms?

  • How to perform bulk insert?

  • How to get the automatically generated (primary) key value?

  • What is the use of Mybatis dynamic sql? How does it work? What are the dynamic SQL?

  • In the Xml mapping file, besides the common select|insert|updae|delete tags, what other tags are there?

  • In the Xml mapping file of Mybatis, can the id be repeated for different Xml mapping files?

  • Why is Mybatis a semi-automatic ORM mapping tool? What is the difference between it and fully automatic?

  • How many ways does MyBatis implement one-to-one? How do you do it?

  • There are several ways to realize one-to-many in MyBatis, how to operate?

  • Does Mybatis support lazy loading? If so, what is its implementation principle?

  • Mybatis's primary and secondary caches:

  • What is the interface binding of MyBatis? What are the ways to achieve it?

  • What are the requirements when using MyBatis's mapper interface to call?

  • Briefly describe the operation principle of Mybatis plug-in and how to write a plug-in.

image

There are also springMVC, microservices, Dubbo, netty, network, zookeeper, kafka, rabbitMQ, readis cache, database, design patterns, so I won’t show you one by one here.

I hope everyone can get a pleasant offer. ***

image

image

image

If you need to get the above information or more advanced Java architecture information, you can click here to get the way to get it . **

Guess you like

Origin blog.csdn.net/m0_46657043/article/details/108830154