After searching more than 10 search engines, I finally sorted out these nearly 200 Java interview questions, full of dry goods after reading the collection

Java collection 22 questions

This is a basic question in java, but don't underestimate these questions, some of them may not be answered. I find that more and more low-level questions are being asked recently. This is also a basic line. If you can’t answer it, it will be cold.

  • The difference between ArrayList and Vector.
  • Talk about the storage performance and characteristics of ArrayList, Vector, LinkedList.
  • What is the difference between fail-fast and fail-safe?
  • The data structure of hashmap.
  • How does HashMap work?
  • When will Hashmap expand?
  • What are the characteristics of the three interfaces of List, Map, and Set when accessing elements?
  • The elements in the Set cannot be repeated, so what method is used to distinguish whether they are repeated? Is == or equals()? What is the difference between them?
  • Two objects have the same value (x.equals(y) == true), but they can have different hash codes. Is this sentence correct?
  • What is the difference between heap and stack.
  • What are the basic interfaces of the Java collection framework?
  • What is the difference between HashSet and TreeSet?
  • What is the underlying implementation of HashSet?
  • How does LinkedHashMap work?
  • Why does the collection class not implement the Cloneable and Serializable interfaces?
  • What is an iterator?
  • What is the difference between Iterator and ListIterator?
  • What is the difference between Array and ArrayList? When should I use Array instead of ArrayList?
  • What are the best practices for the Java collection framework?
  • The elements in a set cannot be repeated, so what method is used to distinguish whether they are repeated or not? Should I use == or equals()? What is the difference between them?
  • What are the Comparable and Comparator interfaces? List their differences
  • The difference between Collection and Collections.

 

JVM and tuning 21 questions

JVM is a must-have knowledge point when you go to a big factory. Performance tuning issues, garbage collection mechanisms, parent delegation, and architecture. The more you get, the more points you get.

I emptied the major search engines and compiled 154 Java dry goods interview questions for you

 

  • Java class loading process?
  • Describe the principle mechanism of JVM loading Class files?
  • Java memory allocation.
  • What is GC? Why is GC?
  • Briefly describe the Java garbage collection mechanism
  • How to judge whether an object is alive? (Or how to determine the GC object)
  • The advantages and principles of garbage collection. And consider 2 recycling mechanisms
  • 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?
  • Will there be a memory leak in Java, please describe briefly
  • Deep copy and shallow copy.
  • What will System.gc() and Runtime.gc() do?
  • When is the finalize() method called? What is the purpose of finalization?
  • If the object reference is set to null, will the garbage collector immediately release the memory occupied by the object?
  • What is the difference between a serial collector and a throughput collector?
  • In Java, when can an object be garbage collected?
  • Briefly describe Java memory allocation and recovery strategies, Minor GC and Major GC.
  • Will garbage collection occur in the permanent generation of the VM?
  • What are the methods of garbage collection in Java?
  • What are class loaders and what are the class loaders?
  • The class loader parent delegation model mechanism?

28 concurrent programming questions

Concurrency is the key point. I remember an interview about concurrency. The interviewer slammed me for half an hour. The arrangement from the lock mechanism to the thread pool was clear.

I emptied the major search engines and compiled 154 Java dry goods interview questions for you

After paying attention, you can get the private message (answer) for free!

  • Have you 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 has VM made to Java's native locks? 48
  • Why is Synchronized an unfair lock? 49
  • What is lock elimination and lock coarsening? 49
  • Why is Synchronized a pessimistic lock? What is the principle of optimistic locking? What is CAS and what are its characteristics?
  • Is optimistic locking necessarily good?
  • Compared with Synchronized, what is the difference in the implementation principle of 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?
  • Apart from ReetrantLock, what other concurrency tools in JUC have you been exposed to?
  • Please talk about ReadWriteLock and StampedLock.
  • How to synchronize Java threads with each other? Which synchronizers have you known? 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 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?
  • 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?

spring 25 questions

I believe everyone has used Spring. As an open source framework, its importance is undoubtedly. IOC and AOP are the two essential cores, from annotations to tags.

I emptied the major search engines and compiled 154 Java dry goods interview questions for you

 

  • 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?
  • 3. What is Inversion of Control (IOC)? What is dependency injection?
  • 4. Please explain the IoC in the Spring framework?
  • 5. What is the difference between BeanFactory and ApplicationContext?
  • 6. How many configuration methods does Spring have?
  • 7. How to configure Spring based on XML configuration?
  • 8. How to configure Spring based on Java configuration?
  • 9. How to configure Spring with annotations?
  • 10. Please explain the life cycle of Spring Bean?
  • 11. What is the difference between the scope of Spring Bean?
  • 12. What is Spring inner beans?
  • 13. Are singleton beans in the Spring framework thread-safe?
  • 14. Please give an example of how to inject a Java Collection in Spring?
  • 15. How to inject a Java.util.Properties into Spring Bean?
  • 16. Please explain the automatic assembly of Spring Bean?
  • 17. Please explain the difference in automatic assembly mode?
  • 18. How to turn on automatic assembly based on annotations?
  • 19. Please give an example to explain the @Required annotation?
  • 20. Please give an example to explain the @Autowired annotation?
  • 21. Please give an example to illustrate the @Qualifier annotation?
  • 22. What is the difference between construction method injection and set value injection?
  • 23. What are the different types of events in the Spring framework?
  • 24. What is the difference between FileSystemResource and ClassPathResource?
  • 25. What design patterns are used in the Spring framework?

10 design patterns

I remember the most clearly the lazy and hungry modes of the singleton mode. The direction of this investigation is generally fixed. Of course, it does not rule out the problems encountered by the interviewer during the inspection and notification work (this is the case for students, and you will not be crazy if you work. Ask applicants, feel sorry for the interviewer).

I emptied the major search engines and compiled 154 Java dry goods interview questions for you

 

  • 1. Please list several commonly used design patterns in JDK?
  • 2. What is a design pattern? Have you used any design patterns in your code?
  • 3. What is the singleton design pattern in Java? Please write a thread-safe singleton pattern in Java
  • 4. In Java, what is the observer design pattern (observer design pattern)?
  • 5. What are the main benefits of using the factory model? Where is it used?
  • 6. Give a decorator design pattern implemented in Java? Does it act on the object level or the class
    level?
  • 7. In Java, why is it not allowed to access non-static variables from static methods?
  • 8. To design an ATM machine, please tell us your design ideas?
  • 9. In Java, when do you use overloading and when do you use rewriting?
  • 10. Give examples of situations where you would prefer to use abstract classes instead of interfaces

springboot 22 questions

Recently, springboot and springcloud account for more and more weight, because they are the most popular among small and medium-sized enterprises, and they are the lowest even if they learn to starve.

I emptied the major search engines and compiled 154 Java dry goods interview questions for you

 

  • What is Spring Boot?
  • What are the advantages of Spring Boot?
  • What is JavaConfig?
  • How to reload changes on Spring Boot without restarting the server?
  • What is the monitor in Spring Boot?
  • How to disable Actuator endpoint security in Spring Boot?
  • How to run Spring Boot applications on custom ports?
  • What is YAML?
  • How to realize the security of Spring Boot application?
  • How to integrate Spring Boot and ActiveMQ?
  • How to use Spring Boot to implement paging and sorting?
  • What is Swagger? Have you implemented it with Spring Boot?
  • What is Spring Profiles?
  • What is Spring Batch?
  • What is a FreeMarker template?
  • How to use Spring Boot to implement exception handling?
  • Which starter maven dependencies did you use?
  • What is a CSRF attack?
  • What is WebSockets?
  • What is AOP?
  • What is Apache Kafka?
  • How do we monitor all Spring Boot microservices?

Spring Cloud 8 questions

  • What is Spring Cloud?

  • What are the advantages of using Spring Cloud?

  • What does service registration and discovery mean? How to achieve Spring Cloud?

  • What is the significance of load balancing?

  • What is Hystrix? How does it achieve fault tolerance?

  • What is a Hystrix circuit breaker? Do we need it?

  • What is Netflix Feign? What are its advantages?

  • What is Spring Cloud Bus? Do we need it?

 After paying attention, you can get the private message (answer) for free!

Redis 8 questions

Redis's data characteristics and recycling strategies are an important part, and its advantages and usage scenarios need to be understood

I emptied the major search engines and compiled 154 Java dry goods interview questions for you

 

  • What is redis?
  • Features of Reids
  • Data types supported by Redis
  • Redis is single-process and single-threaded
  • Virtual Memory
  • Redis lock
  • Read-write separation model
  • Data fragmentation model

55 top-quality interview questions for first-line Internet companies

  • 1. junit usage, the execution order of before, beforeClass, after, afterClass
  • 2. Distributed lock
  • 3. Nginx request forwarding algorithm, how to configure forwarding based on weight
  • 4. What are the problems with using hashmap to implement redis (deadlock, dead loop, ConcurrentH ashmap can be used)
  • 5. Thread status
  • 5. Thread blocking method
  • 6. The difference between sleep and wait
  • 7. The underlying implementation of hashmap
  • 8. Ten thousand people grab 100 red envelopes, how to achieve (without queue), how to ensure that 2 people cannot grab the same red envelope, and distributed locks are available
  • 9. Java memory model, garbage collection mechanism, unreachable algorithm
  • 10. Two Integer reference objects are passed to a swap method to exchange references within the method. After returning, will the values ​​of the two references be found to change?
  • 11. The underlying implementation of aop, how dynamic is the dynamic proxy? If there are 100 objects, how to dynamically proxy these 100 objects
  • 12. Have you ever used maven install. maven test. git (make install is to install the local jar package)
  • 13. Various configurations of tomcat, how to configure docBase

  • 14. Several ways of spring bean configuration

  • 15. Web.xml configuration
  • 16. Listener for spring.
  • 17. The implementation mechanism of zookeeper, there is a cache, how to store the registration service
  • 18. Will IO block? Is readLine blocking
  • 19. Have you ever used spring's thread pool or java's thread pool?
  • 20. String formatting method (20, 21 these two questions are too low-level)
  • 21. Time formatting method
  • 22. What is the timer made of?
  • 23. How the thread exits and ends
  • 24. What locks does java have? Optimistic lock, pessimistic lock, synchronized reentrant lock, read-write lock, used r
  • eentrantlock? The difference between reentrantlock and synmchronized
  • 25. Usage scenarios of ThreadLocal
  • 26. Java's memory model, garbage collection mechanism
  • 27. Why does thread execution call start instead of direct run (direct run is no different from ordinary methods, start first, run will run as a thread method)
  • 28. The realization mechanism of qmq messages (qmq is a message queue encapsulated by Qunar.com)
  • 29. Three ways to traverse hashmap
  • 30. Some commands of jvm 31. The difference between memcache and redis
  • 32. Where is the row-level lock of mysql added?
  • 33. How is the lock of ConcurrentHashmap added? Is the more segments the better
  • 34. The difference between myisam and innodb (innodb is a row-level lock, myisam is a table-level lock)
  • 35. mysql other performance optimization methods
  • 36. Where to look at the linux system log
  • 37. How to view network process
  • 38. Count the number of bit 1 in the binary representation of an integer
  • 39. jvm memory model, java memory model
  • 40. How to dump all the data in java memory
  • 41. How to manually trigger full garbage collection, how to trigger garbage collection immediately
  • 42. What will happen to hashmap if there is only one write and the other read all
  • 43. git rebase
  • 44. The difference between mongodb and hbase 45. How to solve concurrency problems

 

 

Guess you like

Origin blog.csdn.net/x275920/article/details/108762300