1. Summary of interview question modules
The interview questions include the following nineteen modules: Java Basics, Containers, multithreading, reflection, object copy, Java Web modules, exceptions, networking, Design patterns, Spring/Spring MVC, Spring Boot/Spring Cloud, Hibernate, Mybatis, RabbitMQ, Kafka, Zookeeper, MySql, Redis, JVM. As shown below:
Perhaps beginners do not need the framework and JVM module knowledge behind, readers can according to their own situation, choose the corresponding module to read.
Suitable for readers
- Beginning/middle/advanced Java programmers who need to be interviewed
- Someone who wants to fill a gap
- People who want to constantly improve and expand their Java technology stack
- Java the interviewer
Specific interview questions
Let’s take a look at 208 interview questions.
First, Java foundation
1. What is the difference between JDK and JRE?
2. What is the difference between == and equals?
3. If two objects have the same hashCode(), equals() must also be true, right?
4. What does final do in Java?
5. How much is math.round (-1.5) in Java?
6. Is String a basic data type?
7. What are the classes for manipulating strings in Java? What’s the difference between them?
Is String STR =” I “the same as String STR =new String(” I”)?
9. How to reverse a string?
What are the common methods of the String class?
11. Must abstract classes have abstract methods?
12. What are the differences between ordinary classes and abstract classes?
13. Can abstract classes use final?
What is the difference between an interface and an abstract class?
15. How many IO streams are there in Java?
16. What is the difference between BIO, NIO and AIO?
17. What are the common methods of Files?
Second, the container
18. What are Java containers?
19. What’s the difference between Collections and Collections?
20. What is the difference between a List, a Set and a Map?
21. What is the difference between HashMap and Hashtable?
22. How do I decide to use HashMap or TreeMap?
23. How does HashMap work?
24. How does HashSet work?
25. What is the difference between ArrayList and LinkedList?
26. How to convert an array to a List?
27. What is the difference between an ArrayList and a Vector?
28. What’s the difference between Array and ArrayList?
29. What is the difference between poll() and remove() in a Queue?
30. Which collection classes are thread-safe?
31. What is an Iterator?
32. How to use Iterator? What are the characteristics?
33. What is the difference between Iterator and ListIterator?
34. How do I ensure that a collection cannot be modified?
Three, multi-threading
What is the difference between parallelism and concurrency?
36. What is the difference between threads and processes?
37. What is a daemon thread?
38. What are the ways to create a thread?
39. What is the difference between runnable and callable?
What are the states of threads?
41. What’s the difference between sleep() and wait()?
What is the difference between notify() and notifyAll()?
43. What is the difference between run() and start() for a thread?
44. What are the ways to create a thread pool?
What are the states of the thread pool?
46. What is the difference between submit() and execute() methods in the thread pool?
47. How to ensure the safety of multithreading in Java program?
48. What is the upgrade principle of multi-threaded lock?
49. What is a deadlock?
50. How do I prevent deadlocks?
51. What is ThreadLocal? What are the usage scenarios?
Talk about the underlying implementation of synchronized.
53. What is the difference between synchronized and volatile?
54. What’s the difference between synchronized and Lock?
What is the difference between synchronized and ReentrantLock?
56. How does atomic work?
Four, reflection
57. What is reflection?
58. What is Java serialization? When is serialization needed?
59. What is a dynamic proxy? What are the applications?
60. How to implement dynamic proxy?
5. Object copy
61. Why use cloning?
62. How to implement object cloning?
63. What is the difference between deep copy and shallow copy?
Six, Java Web
64. What is the difference between a JSP and a servlet?
65. What built-in objects does JSP have? What are the effects?
66. What are the four scopes of JSP?
67. What is the difference between session and cookie?
68. How does session work?
69. Can session be implemented if the client disables cookies?
70. What is the difference between Spring MVC and Struts?
71. How do I avoid SQL injection?
72. What is an XSS attack and how can it be avoided?
73. What is a CSRF attack and how can it be avoided?
Seven, abnormal
Throws throws 74.
75. What is the difference between final, finally and Finalize?
76. Which part of the try-catch-finally can be omitted?
77. In try-catch-finally, if a catch returns, finally will be executed?
78. What are the common exception classes?
Eight, the network
79. What do HTTP response codes 301 and 302 represent? What’s the difference?
80. What’s the difference between forward and redirect?
81. Describe the differences between TCP and UDP.
82. Why does TCP require three handshakes? Why is that?
How does TCP sticky packet come into being?
84. What are the OSI seven-tier models?
85. What are the differences between GET and POST requests?
86. How to achieve cross-domain?
87. How does JSONP work?
9. Design mode
88. Tell me about a design pattern you are familiar with.
89. What is the difference between a simple factory and an abstract factory?
Ten, Spring/Spring MVC
90. Why use Spring?
Explain what AOP is?
Explain what ioc is.
93. What are the main modules of Spring?
What are the common injection methods in Spring?
95. Are beans in Spring thread-safe?
96. How many scopes does Spring support for beans?
97. What are the methods for Spring to automate bean assembly?
What are the ways in which Spring transactions are implemented?
99. What about Transaction isolation in Spring?
100. What about the Spring MVC workflow?
101. What components does Spring MVC have?
What does 102.@RequestMapping do?
What does 103.@Autowired do?
Spring Boot/Spring Cloud
104. What is Spring Boot?
105. Why Spring Boot?
106. What is the Spring Boot core configuration file?
107. What are the types of Spring Boot configuration files? What’s the difference?
108. How can Spring Boot implement hot deployment?
109. What is the difference between JPA and Hibernate?
110. What is Spring Cloud?
111. What does the Spring Cloud circuit breaker do?
112. What are the core components of Spring Cloud?
Twelve, Hibernate
113. Why use Hibernate?
114. What is ORM Framework?
115. How to view printed SQL statements in The console in Hibernate?
How many query methods does Hibernate have?
117. Can Hibernate entity classes be defined as final?
118. What is the difference between using Integer and int for mapping in Hibernate?
119. How does Hibernate work?
120. The difference between get() and load()?
121. What about Hibernate’s caching mechanism?
122. What are the states of Hibernate objects?
What is the difference between getCurrentSession and openSession in Hibernate?
124. Do Hibernate entity classes have to have parameterless constructors? Why is that?
13, Mybatis
125. What is the difference between #{} and ${} in mybatis?
126. How many pagination methods are there in Mybatis?
127. Does RowBounds query all results at once? Why is that?
128. What is the difference between logical paging and physical paging in Mybatis?
129. Does Mybatis support lazy loading? What is the principle of lazy loading?
What about level 1 cache and level 2 cache in Mybatis?
131. What are the differences between Mybatis and Hibernate?
132. What executors do Mybatis have?
133. What is the implementation principle of mybatis paging plug-in?
134. How to write a custom plug-in for Mybatis?
14, the RabbitMQ
135. What are the usage scenarios for RabbitMQ?
136. What are the important roles of RabbitMQ?
137. What are the important components of RabbitMQ?
138. What is vhost for rabbitMQ?
139. How are rabbitMQ messages sent?
140. How does RabbitMQ ensure message stability?
141. How can RabbitMQ avoid message loss?
142. What are the conditions for successful message persistence?
143. What are the disadvantages of RabbitMQ persistence?
144. How many broadcast types are available for RabbitMQ?
145. How does RabbitMQ implement delayed message queuing?
146. What are rabbitMQ clusters for?
147. What are the types of RabbitMQ nodes?
148. What should I pay attention to when setting up rabbitMQ clusters?
149. Is each rabbitMQ node a full copy of the other nodes? Why is that?
150. What happens when the only disk node in the RabbitMQ cluster crashes?
151. Does RabbitMQ have a stop order for cluster nodes?
15, Kafka
Can Kafka be used independently of ZooKeeper? Why is that?
153. How many data retention strategies does Kafka have?
154. Kafka sets 7 days and 10 gigabytes of clean data at the same time, and on the fifth day it reaches 10 gigabytes of clean data.
155. What can cause Kafka to run slowly?
156. What should I pay attention to when using kafka clusters?
16, a Zookeeper
157. What is Zookeeper?
158. What functions does ZooKeeper have?
159. How many deployment modes are available for ZooKeeper?
160. How does ZooKeeper synchronize the status of the primary and secondary nodes?
161. Why have a primary node in a cluster?
162. There are three servers in the cluster and one node is down. Is ZooKeeper still available?
163. What is the notification mechanism of ZooKeeper?
The 17th and MySql
164. What are the three paradigms of databases?
Mysql > alter table alter table alter table alter table alter table alter table alter table alter table alter table alter table alter table alter table alter table
166. How do I obtain the current database version?
167. What is ACID?
168. What is the difference between char and varchar?
169. What is the difference between float and double?
170. What is the difference between inner join, left join, right join in mysql?
171. How is the mysql index implemented?
172. How to verify that the mysql index meets the requirement?
173. What about transaction isolation of databases?
174. What is the common mysql engine?
175. What about row and table locks in mysql?
176. What about optimistic and pessimistic locks?
177. What are the methods used to troubleshoot mysql problems?
178. How to optimize mysql performance?
Eighteen, Redis
179. What is redis? What are the usage scenarios?
180. What functions does Redis have?
181. What’s the difference between Redis and memecache?
182. Why is Redis single threaded?
183. What is cache penetration? How to solve it?
184. What data types are supported by Redis?
185. What Java clients does Redis support?
186. What are the differences between Jedis and Redisson?
187. How to ensure the consistency of cache and database data?
188. How many ways can REDis persist?
189. How does Redis implement distributed lock?
190. What are the defects of redis distributed locks?
191. How does Redis optimize memory?
192. What are the Redis elimination strategies?
193. What are the common performance issues with Redis? How to solve it?
In the 19th, the JVM
194. What are the main components of the JVM? And its role?
195. What about the JVM runtime data area?
196. What is the difference between stacks?
197. What are queues and stacks? What’s the difference?
198. What is the parental delegation model?
199. What about the execution of class loading?
200. How to determine whether an object can be reclaimed?
201. What reference types are available in Java?
202. What garbage collection algorithms does the JVM have?
203. What garbage collectors does the JVM have?
204. What about CMS garbage collector?
205. What are the new generation garbage collectors and old generation garbage collectors? What’s the difference?
206. Describe briefly how generational garbage collector works.
207. What about JVM tuning tools?
208. What are the common JVM tuning parameters?
2. Summary of answers to interview questions