I myself should have participated in no fewer than 40 or 50 interviews in total. In addition, I have compiled this interview question bank by referring to some interview questions on the Internet, and I hope I can help you.
Space is limited. I selected 15 of the thousands of interview questions from various technical directions and shared them with you
You can pay attention to the public account: [Java column], send " questions " to get the complete interview questions (organized into a PDF with a catalog)
or ☺️☺️Click here to get the interview manual and answers😌😌
Java basics
1. short s1 = 1; s1 = s1 + 1; is there any error? short s1 = 1; s1 += 1; is there any error
2. What is the difference between abstract classes and interfaces in Java?
3. The difference between static variables and ordinary variables
4. Related to internal classes, see the program to tell the results of the operation
5. The difference between & and &&
6. What are the classifications of internal classes?
7. What is a static block?
8. What are the uses of final?
9. Can int be cast to byte type variable? If the value is greater than the byte type range, what will happen?
10. The difference between access modifiers public, private, protected, and not written (default)
11. What is the difference between == and equals?
12. The difference between JDK and JRE and JVM
13. Define the role of a constructor that does nothing and has no parameters in Java
14. What is Java
15. What is the importance of the main() method in Java?
String
16. What are the commonly used methods of the String class?
17. What are the benefits of String being immutable?
18. What is a string pool?
19. String s = new String("xyz"); How many StringObjects have been created? Is it possible to inherit the String class?
20. The difference between String, StringBuffer and StringBuilder (similar to the previous question)
21. How to split a String?
22. How many objects are created in the following statement: String s="a"+"b"+"c"+"d"
23. How to compare two strings?
24. Why introduce two string processing classes, SpringBuffer and StringBuilder?
25. How to convert String to char, and vice versa?
26. What are the classes of manipulation strings in Java? What is the difference between them?
27. What are the different ways to create String objects?
28. Is String str="i" the same as String str=new String("i")?
29. What is String and what data type is it?
30. How to convert String to byte array, and vice versa?
container
31. Talk about the expansion mechanism of ArrayList
32. What are the best practices related to the Java Collection Framework?
33. What is the difference between ArrayList and LinkedList?
34. What is the difference between Iterater and ListIterator?
35. Why does the Map interface not inherit the Collection interface?
36. How to sort the list of Objects
37. What is the difference between synchronous collection and concurrent collection in Java
38. What are the general algorithms implemented in the collection framework?
39. What are the Comparable and Comparator interfaces?
40. Through the iterator fail-fast attribute, what do you understand?
41. How to avoid ConcurrentModificationException when iterating a collection?
42. The realization principle of HashMap
43. What is the Collections class?
44. What is the difference between fail-fast and fail-safe?
45. What is the difference between ArrayList and LinkedList?
Multi-threaded concurrency
46. What happens if an exception occurs when a thread is running?
47. The difference between synchronized and ReentrantLock
48. What is the Java Timer class? How to create a task with a specific time interval?
49. How many uses of Synchronized?
50. What are the basic states of threads?
51. What are the statuses of the thread pool?
52. Why do we execute the run() method when we call the start() method, and why can’t we call the run() method directly?
53. What is the difference between interrupted and isInterrupted methods in Java?
54. What are the functions of creating thread pool parameters?
55. Please tell me the methods related to thread synchronization and thread scheduling.
56. The level of thread safety
57. Thread Status
58. What is the role of Thread.sleep(0)
59. What is the difference between Executor, ExecutorService, and Executors in Java?
60. Synchronization method and synchronization block, which is the better choice
abnormal
61. Briefly talk about the simple principle and application of the exception handling mechanism in Java.
62. Introduction to Java Exceptions
63. What is a checked exception
64. Classification of Java Exceptions
65. Excption and Error packet structure
66. Explain the difference between final, finally, and finalize
67. What is the difference between Error and Exception?
68. What are the similarities and differences between runtime exceptions and general exceptions?
69. List some of your common runtime exceptions?
70. The difference between Throw and throws
71. There is a return statement in try {}, then the code in finally{} immediately after the try will be executed, when will it be executed, before or after return?
Generic
72. Common Features of Generics
73. What is Generic
74. What is the difference between List<? extends T> and List <? super T>?
75. How to write a generic method so that it can accept generic parameters and return a generic type?
76. What are the qualified and unqualified wildcards in generics?
77. How does Java generics work? What is type erasure?
78. Can you pass List<String> to a method that accepts List<Object> parameters?
79. What are the benefits of using generics?
80. What is generic erasure
Serialization
81. What types of variables will not be serialized?
82. If you don't define serialVersionUID, what will happen?
83. What is the use of
84. If a certain class implements Serializable but the parent class does not, what is the state of the object when deserialization is performed?
85. How many methods does the Serializable interface have? If there is no method, then why is there such an interface?
86. If you don't want certain members to be serialized, what should you do?
87. What is the use of serialVersionUID and how to use serialVersionUID
88. What is the difference between Serializable and Externalizable interfaces?
89. serialization and deserialization
90. Can I customize the serialization process?
91. What is java serialization and how to implement java serialization? Or please explain the role of the Serializable interface.
reflection
92. What are the application scenarios of the reflection mechanism?
93. What can the reflection mechanism do?
94. Three Ways to Obtain Reflection in Java
95. Where is the reflection mechanism used?
96. What is the reflection mechanism?
97. Advantages and disadvantages of reflection mechanism
98. The role of Java reflection mechanism
99. How to use Java reflection?
File I/O
100. How to convert byte stream to character stream?
101. How to create ByteBuffer in Java?
102. Talk about common classes in Java IO, byte stream, character stream, interface, implementation class, method blocking
superclass (16197609e8e164 are abstract classes ) of the stream class in Java?
104. Talk about RandomAccessFile?
105. Talk about the File class
106. How many types of streams are there in Java?
107. IO Pipeline
108. What are the common methods of Files?
109. What is Filter flow?
110. When file is copied to , which stream can be used to improve more performance?
111. Talk about NIO
112. Say 5 IO best practices (answers)
113. System.in, System.out, System.err
114. What is System.out.println()?
Object-oriented
115. Why does Java not support multiple inheritance?
116. In Java, what can subclasses inherit from the parent class?
117. What features does the package have?
118. What are the two benefits of internal classes?
119. What are the five basic principles of object-oriented (optional)
120. The role of internal classes?
121. The difference between object-oriented and process-oriented
122. What is a polymorphic mechanism? How does the Java language achieve polymorphism?
123. What are the characteristics of object-oriented
124. Understanding of Java Polymorphism
125. Does Java support multiple inheritance?
The internet
126. The difference between TCP and UDP
127. Why is the URL encoded in the GET request?
128. The difference between TCP and UDP:
129. What is TCP/IP and UDP
130. TCP/IP four-layer model
131. What is a cookie
132. What is the network protocol
133. What is a cross-site attack CSRF?
134. What is XSS attack?
135. Application scenarios of TCP and UDP:
136. Classification of IP addresses
137. Do you know the addressing process of DNS?
138. Do you know how TCP handles congestion?
139. What are the commonly used HTTP methods?
140. Computer Network Architecture
JVM
141. Talk about how the JVM executes the bytecode in the class.
142. How did the subject enter the old age from the young generation?
143. Which important parameters of the G1 garbage collector have you used?
144. Give some examples of breaking the parental delegation mechanism that you know. Why break?
145. How to judge the object can be recycled?
146. What memory area does JVM have? (What is the memory layout of JVM?)
147. How to get the memory used by the Java program? What percentage of the heap is used?
148. When do MinorGC, MajorGC and FullGC happen?
149. If the reference of the object is set to null, will the garbage collector immediately release the memory occupied by the object?
150. Where is the memory allocated for the object?
151. How to open and view GC log?
152. Diagram of several core parameters related to JVM memory
153. Which JVM performance tuning do you know
154. Garbage Collection Algorithm
155. What are the JVM configuration parameters commonly used in work?
MySQL
156. What is the default port number of MySql service?
157. The difference between MyISAM index and InnoDB index?
158. MySQL replication basic principle process
159. The difference between UNION and UNION ALL?
160. What is the difference between FLOAT and DOUBLE?
161. What are the characteristics of the MyISAM storage engine?
162. Six types of related queries
163. What is the index? What are the effects and advantages and disadvantages?
164. Will non-clustered indexes always return to table queries?
165. What kind of data structure is an index?
166. What storage engines does MySQL support?
167. What is the difference or pros and cons between Hash index and B+ tree?
168. Which engine does SELECT COUNT(*) perform faster?
169. So under what circumstances will it happen that an index is created for the column but is not used in the query?
170. What are the four major features of the InnoDB engine?
Redis
171. Redis data types and usage scenarios of each data type
172. What are the redis expiration strategies? Does the LRU algorithm know?
173. How to ensure data consistency between the cache and the database when it is double-written?
174. Please use Redis and any language to implement a piece of malicious login protection code, and limit each user ID can only log in at most 5 times within 1 hour. The specific login function or function can be used as an empty function, and there is no need to write it out in detail.
175. Why use redis/why use cache
176. Will there be write operation loss in Redis cluster? Why?
177. What are the suitable scenarios for Redis?
178. Timed deletion strategy
179. What are the suitable scenarios for Redis?
180. Why single-threaded redis is so fast
181. What kinds of data elimination strategies does Redis have?
182. Watch dog automatic extension mechanism
183. What is the use of pipelines in Redis?
184. Under what circumstances will the Redis cluster solution cause the entire cluster to be unavailable?
185. What is Redis persistence?
MyBatis
186. In the Xml mapping file, besides the common select|insert|updae|delete tags, what other tags are there?
187. Why need precompilation
188. What are the differences between MyBatis and Hibernate?
189. What is Mybatis?
190. What is ORM
191. Is RowBounds query all results at once? Why?
192. Please tell me the working principle of MyBatis
193. What is the functional architecture of MyBatis?
194. What are the shortcomings of JDBC programming, and how does MyBatis solve these problems?
195. What is a DBMS
196. When the attribute name in the entity class is different from the field name in the table, what should I do?
197. One-to-one, one-to-many related queries?
198. Why is Mybatis a semi-automatic ORM mapping tool? What is the difference between it and fully automatic?
199. Applicable occasions of MyBatis framework:
200. How many ways are there to write Mapper?
Spring
201. Explain the JDBC abstraction and DAO module
202. Spring transaction implementation and implementation principles:
203. In Spring, there are several ways to configure Beans?
204. Talk about the Spring loading process.
205. The realization principle of Spring AOP.
206. What is the Spring IOC container?
207. What is the use of Spring MVC framework?
208. The realization principle of IoC in Spring is the factory pattern plus reflection mechanism.
209. BeanFactory-BeanFactory implementation examples
210. The difference between Constructor Dependency Injection and Setter Method Injection
211. What is the process of using @Autowired annotations for automatic assembly?
212. What is the use of @Autowired annotations?
213. What types of Spring notifications are there?
214. How to configure Spring with annotations?
215. What design patterns are used in the Spring Framework
SpringBoot
216. How to integrate Spring Boot and ActiveMQ?
217. What is Swagger? Have you implemented it with Spring Boot?
218. What logging frameworks does Spring Boot support? Which is the recommended and default logging framework?
219. Spring Boot scanning process?
220. What are the starters commonly used in SpringBoot?
221. Springboot integration process of mybatis
222. What is the easiest way to create a Spring Boot Project?
223. What is JavaConfig?
224. What is JavaConfig?
225. How do you understand Starters in Spring Boot?
226. What other Starter Project Options does Spring Boot provide?
227. Why do we need spring-boot-maven-plugin?
228. Why do we not recommend using Spring Data Rest in actual applications?
229. What is the principle of SpringBoot automatic configuration?
230. What is the difference between a Spring Boot jar and a regular jar?
SpringCloud
231. Spring Cloud sub-projects (main projects)
232. What is the microservice architecture?
233. What are the advantages of using Spring Cloud?
234. As a service registration center, how is Eureka better than Zookeeper?
235. How do microservices provide a unified interface to the outside world (specific use by zuul)
236. What is a microservice?
237. What is the significance of load balancing?
238. What is Zuul routing gateway
239. What can the distributed configuration center do?
240. What is Netflix Feign? What are its advantages?
241. What can Ribbon load balancing do?
242. What is Netflix Feign? What are its advantages?
243. What are the advantages of using Spring Cloud?
244. What are the core components of spring cloud
245. What does service registration and discovery mean? How to implement Spring Cloud?
Dubbo
246. What is Dubbo?
247. Why use Dubbo?
248. Dubbo timeout setting
249. Does Dubbo need a web container?
250. Tell me about the process of service exposure?
251. What are the core configurations of Dubbo?
252. What are the core configurations of Dubbo?
253. What is the recommended fault tolerance strategy for service reading and writing?
254. Draw a flowchart of service registration and discovery
255. What is the difference between Dubbo and Dubbox?
256. Do you know other distributed frameworks?
257. What are the core components of Dubbo?
258. How is the service online compatible with the old version?
259. Tell me about the process of service reference?
260. What serialization framework Dubbo recommends, and what else do you know?
Nginx
261. Why is Nginx so high performance?
262. What are the advantages of using a "reverse proxy server?"
263. Nginx static resources?
264. How to limit current?
265. How to configure Nginx virtual host?
266. How to use Nginx to solve the front-end cross-domain problem?
267. How to configure Nginx configuration high availability?
268. Why do dynamic and static separation?
269. How does Nginx judge the IP is not accessible?
270. Please list some characteristics of Nginx
271. How does Nginx separate dynamics and statics?
272. How is the Nginx load balancing algorithm implemented? What are the strategies?
273. Nginx commonly used variables
274. Please explain how Nginx handles HTTP requests?
275. Location regular case
zookeeper
276. Zookeeper Watcher mechanism-data change notification
277. Server-side processing Watcher implementation
278. Four types of data nodes Znode
279. What are the java clients of Zookeeper?
280. Chroot Features
281. Server working status under Zookeeper
282. ACL permission control mechanism
283. Tell me about Zookeeper's notification mechanism?
284. Client registration Watcher implementation
285. Typical application scenarios of Zookeeper
286. What are the functions of Zookeeper?
287. What does ZooKeeper provide?
288. Why is there a Master in a distributed cluster?
289. What is ZooKeeper?
290. There are 3 servers in the cluster, and one of the nodes is down. Can Zookeeper still be used at this time?
MQ
291. How can consumers reject the currently accepted message for some reasons?
292. What commonly used MQ do you know?
293. ensure that messages are not re-consumed?
294. ensure the order of messages?
295. What happens when the consumer and queue are not equal to the load balancing of consumption?
296. What are the major components of the AMQP model?
297. What is vhost? What role does it play?
298. RocketMq load balance?
299. AMQP protocol layer 3?
300. How to deal with the message accumulation of RocketMQ?
301. What are the node types in the cluster?
302. Is there a limit on the number of messages stored in a queue on RabbitMQ?
303. What is the reason for the relatively high performance of RocketMq?
304. What is RabbitMQ?
305. How to make RocketMQ guarantee the sequential consumption of messages?
Kafka
306. Tell me about your understanding of Kafka idempotence?
307. What are the frameworks for
308. How does Kafka achieve high throughput?
309. What do leaders and followers mean in Kafka?
310. How does Kafka achieve such a high read and write efficiency?
311. What is the role of zookeeper in kafka, can you not use zookeeper
312. The purpose of Kafka partitioning?
313. Consumer and topic relationship
314. Are the messages in Kafka ordered? How did it happen?
315. What is kafka
316. Kafka delete messages manually?
317. Do you know how Kafka achieves orderly messages?
318. What are the disadvantages of Kafka?
319. What are some unique features of Kafka Stream?
320. Why does Kafka not support read-write separation?
ElasticSearch
321. What is the difference between exact matching search and full-text search matching search?
322. Describe in detail the process of ES indexing documents?
323. How does ElaticSearch realize the master election?
324. How to use the character filter in Elasticsearch Analyzer?
325. ES write data process
326. What are the advantages of REST API in Elasticsearch?
327. Please explain the process of adding or creating indexes in Elasticsearch cluster?
328. In the case of concurrency, if ES guarantees consistent reading and writing?
329. What to do if there is too much data in elasticsearch index, how to tune and deploy
330. Can you list the main available field data types related to Elasticsearch?
331. How much do you know about elasticsearch, talk about your company's es cluster architecture, index data size, how many shards, and some tuning methods.
332. How does ES achieve the aggregation of large amounts of data (on the order of hundreds of millions)?
333. Describe the process of ES search in detail?
334. What are the various possible ways we can perform searches in Elasticsearch?
335. How much Elasticsearch knows, talk about your company's es cluster architecture, index data size, how many shards, and some tuning methods.
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。