preface

In two months, I will enter the golden three silver four, but in the face of this year’s environment, the difficulty of job-hopping success is much higher than in previous years, obviously feeling is: for this year’s Java developer friend job-hopping interview, no matter one or two interviews, all began to test the technical skills and foundation of a Java programmer. Understanding the source code interpretation and core principles is also a plus, especially for some core basic knowledge of Java is not enough or no system direction of the friend interview has become a distressed thing.

Today in this share the current domestic company Java interview often asked questions including JVM, commonly used algorithms and data structures, Redis cache, distributed, Spring, micro services and so on. Is the so-called know yourself and know your enemy, only the system of knowledge consolidation, in the face of constantly updated technology to quickly master, at the same time in the interview, work can also stand out!

150 Frequently asked Java Architecture interview questions

Java set 22

  1. Difference between an ArrayList and a Vector.

  2. Talk about storage performance and features for ArrayList,Vector, and LinkedList.

  3. What is the difference between fail-fast and fail-safe?

  4. The data structure of the HashMap.

  5. How does HashMap work?

  6. When will Hashmap be expanded?

  7. What are the features of the List, Map, and Set interfaces when accessing elements?

  8. Elements in a Set cannot be repeated, so what is the way to distinguish between repeated and not? Equals == or equals()? What’s the difference?

  9. Two objects with the same value (x.equals(y) == true) can have different hash codes.

  10. What’s the difference between heap and stack?

  11. What are the basic interfaces of the Java Collection Class framework?

  12. What’s the difference between HashSet and TreeSet?

  13. What is the underlying implementation of HashSet?

  14. How does LinkedHashMap work?

  15. Why do collection classes not implement Cloneable and Serializable interfaces?

  16. What is an Iterator?

  17. What is the difference between Iterator and ListIterator?

  18. What’s the difference between an Array and an ArrayList? When should you use Array instead of ArrayList?

  19. What are the best practices for Java collection class frameworks?

  20. Elements in a Set cannot be repeated, so what is the way to distinguish between repeated and not? Equals == or equals()? What’s the difference?

  21. What are the Comparable and Comparator interfaces for? List the differences

  22. The difference between Collections and Collections.

JVM and tuning 21

  1. Java class loading process?

  2. Describe how the JVM loads Class files.

  3. Java memory allocation.

  4. What is GC? Why GC?

  5. Describe the Java garbage collection mechanism

  6. How do you tell if an object is alive? (or GC object determination method)

  7. Advantages and principles of garbage collection. Two recycling mechanisms are considered

  8. What is the rationale behind the garbage collector? Can the garbage collector reclaim memory right away? Is there any way to proactively notify the virtual machine for garbage collection?

  9. Is there a memory leak in Java? Please describe it briefly

  10. Deep copy and shallow copy.

  11. What do system.gc () and Runtime.gc() do?

  12. When is the Finalize () method called? What is the purpose of finalization?

  13. If a reference to an object is set to NULL, does the garbage collector immediately free 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. When can objects be garbage collected in Java?

  17. Briefly describe the Java memory allocation and reclamation policy and the Minor and Major GC.

  18. Does garbage collection occur in JVM permanent generations?

  19. What are the methods of garbage collection in Java?

  20. What is a class loader, and what are class loaders?

  21. Class loader parent delegate model mechanism?

Concurrent programming 28 problems

  1. Has Synchronized ever been used? What’s the mechanism?

  2. You mentioned a lock on an object. What exactly is this “lock”? How do I determine the lock of an object?

  3. What is reentrant and why is Synchronized reentrant?

  4. What optimization has the JVM made to Java’s native locking? 48

  5. Why is Synchronized unfair? 49

  6. What is lock elimination and lock coarsening? 49

  7. Why is Synchronized a pessimistic lock? What is the implementation principle of optimistic lock? What is CAS and what are its features?

  8. Is optimism lock necessarily good?

  9. How is the implementation principle of ReentrantLock different from Synchronized?

  10. So what is the AQS framework?

  11. Compare Synchronized and ReentrantLock in as much detail as possible.

  12. How does ReentrantLock achieve reentrancy?

  13. Besides ReetrantLock, what other concurrency tools in JUC have you been exposed to?

  14. Talk about ReadWriteLock and StampedLock.

  15. How do I synchronize Java threads with each other? What synchronizers have you learned about? Please introduce them separately.

  16. CyclicBarrier and CountDownLatch look very similar.

  17. Java thread pool related issues

  18. How is thread pooling implemented in Java?

  19. How many core construction parameters to create a thread pool?

  20. How are threads created in a thread pool? Was it created initially with the start of the thread pool?

  21. Since you can create different thread pools by configuring different parameters, what are the default thread pools implemented in Java? Please compare their similarities and differences

  22. How do I submit a thread in a Java thread pool?

  23. What is the Java memory model, and how do threads in Java see each other’s variables?

  24. Talk about what is special about volatile, and why it makes variables visible to all threads?

  25. Since volatile guarantees variable visibility between threads, does that mean that operations based on volatile variables are concurrency safe?

  26. Compare volatile to Synchronized.

  27. How does ThreadLocal address concurrency security?

  28. When using ThreadLocal, you need to be careful.

Spring Interview

  • 1. What is the Spring Framework? What are the main modules of the Spring framework?

  • 2. What are the benefits of using the Spring framework?

  • What is inversion of Control (IOC)? What is dependency injection?

  • 4. Please explain IoC in the Spring framework.

  • What is the difference between BeanFactory and ApplicationContext?

  • How many ways can Spring be configured?

  • 7. How to configure Spring based on XML configuration?

  • 8. How to configure Spring based on Java configuration?

  • How to configure Spring with annotations?

  • Explain the life cycle of Spring beans?

  • What are the differences between Spring Bean scopes?

  • What are Spring inner beans?

  • 13. Are singleton Beans in the Spring framework thread safe?

  • Can you give an example of how to inject a Java Collection into Spring?

  • How do I inject a java.util.properties into a Spring Bean?

  • 16. Explain the autowiring of Spring beans?

  • 17. Please explain the difference between automatic assembly modes.

  • 18. How do I enable annotation-based autowiring?

  • 19. Please give an example to explain the @required annotation?

  • Can you give an example of the @autowired annotation?

  • 21. Can you give an example of @qualifier annotation?

  • What is the difference between constructor injection and set injection?

  • 23. What are the different types of events in the Spring framework?

  • What is the difference between FileSystemResource and ClassPathResource?

  • 25. What design patterns are used in the Spring framework?

Design patterns

  • 1. How many design patterns are commonly used in the JDK?

  • 2. What are design patterns? Do you use any design patterns in your code?

  • 3. What is singleton design pattern in Java? Write thread-safe singleton patterns in Java

  • 4. What is the Observer Design Pattern in Java?

  • 5. What are the main benefits of using the factory model? Where is it used?

  • 6. What is a decorator design pattern implemented in Java? Does it apply to object hierarchies or classes

  • Level?

  • 7. In Java, why are non-static variables not allowed to be accessed from static methods?

  • 8. How to design an ATM machine?

  • 9. When do YOU use overloading and when do you use overwriting in Java?

  • 10. Give an example of a situation where an abstract class is preferred over an interface

Springboot Interview feature

  1. What is Spring Boot?

  2. What are the advantages of Spring Boot?

  3. What is JavaConfig?

  4. How do I reload changes on Spring Boot without restarting the server?

  5. What is a monitor in Spring Boot?

  6. How to disable THE SECURITY of the Actuator in Spring Boot?

  7. How do I run a Spring Boot application on a custom port?

  8. What is YAML?

  9. How can Spring Boot applications be secured?

  10. How to integrate Spring Boot and ActiveMQ?

  11. How do I use Spring Boot for paging and sorting?

  12. What is Swagger? Did you implement it with Spring Boot?

  13. What are Spring Profiles?

  14. What is Spring Batch?

  15. What is a FreeMarker template?

  16. How do I implement exception handling using Spring Boot?

  17. Which Starter Maven dependencies do you use?

  18. What is a CSRF attack?

  19. What are WebSockets?

  20. What is AOP?

  21. What is Apache Kafka?

  22. How do we monitor all Spring Boot microservices?

Netty10 topic

  1. What is the difference between BIO, NIO and AIO?

  2. What is NIO made of?

  3. The Netty thing?

  4. Netty’s threading model?

  5. What is the cause and solution of TCP packet Sticking/unpacking?

  6. What serialization protocols do you know?

  7. How do I choose a serialization protocol?

  8. Zero copy implementation of Netty?

  9. What is Netty’s high performance?

  10. NIOEventLoopGroup source?

Redis

  1. What is redis?

  2. The characteristics of the Reids

  3. Data types supported by Redis

  4. Redis is single-process, single-thread

  5. Virtual memory

  6. Redis lock

  7. Read/write separation model

  8. Data fragmentation model

  9. Redis’ recycling strategy

  10. What are the benefits of using Redis?

  11. What advantages does Redis have over memcached? 4

  12. Redis Common performance problems and solutions

  13. MySQL has 2000W data, redis only 20W data, how to ensure that redis data is hot data

  14. What are the differences between Memcache and Redis?

  15. What are the common performance issues with Redis? How to solve it?

  16. Redis is the most suitable scenario

Conclusion:

All interview questions are not immutable, the above interview questions just give you a reference role, the most important is to increase their knowledge reserve, be prepared.