preface
Gold nine silver ten has passed, 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, are beginning 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!
Due to space reasons, I will not show all the answers in this paper. I have sorted out these questions into PDF files and shared them with those friends who need them for free. At the same time, sorting also took a lot of time
150 Frequently asked Java Architecture interview questions
Java set 22
- Difference between an ArrayList and a Vector.
- Talk about storage performance and features for ArrayList,Vector, and LinkedList.
- What is the difference between fail-fast and fail-safe?
- The data structure of the HashMap.
- How does HashMap work?
- When will Hashmap be expanded?
- What are the features of the List, Map, and Set interfaces when accessing elements?
- 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?
- Two objects with the same value (x.equals(y) == true) can have different hash codes.
- What’s the difference between heap and stack?
- What are the basic interfaces of the Java Collection Class framework?
- What’s the difference between HashSet and TreeSet?
- What is the underlying implementation of HashSet?
- How does LinkedHashMap work?
- Why do collection classes not implement Cloneable and Serializable interfaces?
- What is an Iterator?
- What is the difference between Iterator and ListIterator?
- What’s the difference between an Array and an ArrayList? When should you use Array instead of ArrayList?
- What are the best practices for Java collection class frameworks?
- 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?
- What are the Comparable and Comparator interfaces for? List the differences
- The difference between Collections and Collections.
JVM and tuning 21
- Java class loading process?
- Describe how the JVM loads Class files.
- Java memory allocation.
- What is GC? Why GC?
- Describe the Java garbage collection mechanism
- How do you tell if an object is alive? (or GC object determination method)
- Advantages and principles of garbage collection. Two recycling mechanisms are considered
- 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?
- Is there a memory leak in Java? Please describe it briefly
- Deep copy and shallow copy.
- What do system.gc () and Runtime.gc() do?
- When is the Finalize () method called? What is the purpose of finalization?
- If a reference to an object is set to NULL, does the garbage collector immediately free the memory occupied by the object?
- What is Distributed Garbage Collection (DGC)? How does it work?
- What is the difference between a serial collector and a throughput collector?
- When can objects be garbage collected in Java?
- Briefly describe the Java memory allocation and reclamation policy and the Minor and Major GC.
- Does garbage collection occur in JVM permanent generations?
- What are the methods of garbage collection in Java?
- What is a class loader, and what are class loaders?
- Class loader parent delegate model mechanism?
Concurrent programming 28 problems
- Has Synchronized ever been used? What’s the mechanism?
- You mentioned a lock on an object. What exactly is this “lock”? How do I determine the lock of an object?
- What is reentrant and why is Synchronized reentrant?
- What optimization has the JVM made to Java’s native locking? 48
- Why is Synchronized unfair? 49
- What is lock elimination and lock coarsening? 49
- Why is Synchronized a pessimistic lock? What is the implementation principle of optimistic lock? What is CAS and what are its features?
- Is optimism lock necessarily good?
- How is the implementation principle of ReentrantLock different from Synchronized?
- So what is the AQS framework?
- Compare Synchronized and ReentrantLock in as much detail as possible.
- How does ReentrantLock achieve reentrancy?
- Besides ReetrantLock, what other concurrency tools in JUC have you been exposed to?
- Talk about ReadWriteLock and StampedLock.
- How do I synchronize Java threads with each other? What synchronizers have you learned about? Please introduce them separately.
- CyclicBarrier and CountDownLatch look very similar.
- Java thread pool related issues
- How is thread pooling implemented in Java?
- How many core construction parameters to create a thread pool?
- How are threads created in a thread pool? Was it created initially with the start of the thread pool?
- 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
- How do I submit a thread in a Java thread pool?
- What is the Java memory model, and how do threads in Java see each other’s variables?
- Talk about what is special about volatile, and why it makes variables visible to all threads?
- Since volatile guarantees variable visibility between threads, does that mean that operations based on volatile variables are concurrency safe?
- Compare volatile to Synchronized.
- How does ThreadLocal address concurrency security?
- 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?
The answer,
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
The answer,
Springboot Interview feature
- What is Spring Boot?
- What are the advantages of Spring Boot?
- What is JavaConfig?
- How do I reload changes on Spring Boot without restarting the server?
- What is a monitor in Spring Boot?
- How to disable THE SECURITY of the Actuator in Spring Boot?
- How do I run a Spring Boot application on a custom port?
- What is YAML?
- How can Spring Boot applications be secured?
- How to integrate Spring Boot and ActiveMQ?
- How do I use Spring Boot for paging and sorting?
- What is Swagger? Did you implement it with Spring Boot?
- What are Spring Profiles?
- What is Spring Batch?
- What is a FreeMarker template?
- How do I implement exception handling using Spring Boot?
- Which Starter Maven dependencies do you use?
- What is a CSRF attack?
- What are WebSockets?
- What is AOP?
- What is Apache Kafka?
- How do we monitor all Spring Boot microservices?
Detailed explanation of interview answers
Netty10 topic
- What is the difference between BIO, NIO and AIO?
- What is NIO made of?
- The Netty thing?
- Netty’s threading model?
- What is the cause and solution of TCP packet Sticking/unpacking?
- What serialization protocols do you know?
- How do I choose a serialization protocol?
- Zero copy implementation of Netty?
- What is Netty’s high performance?
- NIOEventLoopGroup source?
Redis
- What is redis?
- The characteristics of the Reids
- Data types supported by Redis
- Redis is single-process, single-thread
- Virtual memory
- Redis lock
- Read/write separation model
- Data fragmentation model
- Redis’ recycling strategy
- What are the benefits of using Redis?
- What advantages does Redis have over memcached? 4
- Redis Common performance problems and solutions
- MySQL has 2000W data, redis only 20W data, how to ensure that redis data is hot data
- What are the differences between Memcache and Redis?
- What are the common performance issues with Redis? How to solve it?
- Redis is the most suitable scenario
Due to space reasons, I will not do all the show here, these questions I have sorted into PDF documents to share for free to those who need friends, at the same time sorting also took a lot of time, friends in need can help forward sharing next follow the following public account to obtain