Summary of 198 Java interview questions that interviewers like to ask most in 2020 (including answer analysis)

foreword

2020 is coming to an end, and many friends asked, have you sorted out some interview questions this year? Recently, I took the time to sort out a Java interview question. Perhaps this interview question is not enough to cover all Java questions, but with it, I believe it is enough to deal with most of the Java interviews currently on the market, because this article has covered both in terms of depth and breadth. A lot of knowledge points.

The modules included in this interview question are divided into 19 modules, namely: Java foundation, container, multithreading, reflection, object copy, Java Web, exception, network, design pattern, Spring/Spring MVC, Spring Boot/Spring Cloud , Hibernate, MyBatis, RabbitMQ, Kafka, Zookeeper, MySQL, Redis, JVM. As shown below

This article is mainly to organize a more practical interview list for readers and friends, let's enter the topic together.

Summary of interview questions

1. Java basic series interview questions

1. What is the difference between JDK and JRE?

2. What is the difference between == and equals

3. If the hashCode() of two objects is the same, then equals() must also be true, right?

4. What is the role of final in Java?

5. What is Math. round(-1. 5) equal to in Java?

6. Is String a basic data type?

7. What classes are there for manipulating strings in Java? What's the difference between them?

8. Is String str="i" the same as String str=new String("i")?

9. How to reverse a string?

10. What are the commonly used methods of the String class?

11. Does an abstract class have to have abstract methods?

12. What is the difference between a normal class and an abstract class?

13. Can an abstract class be decorated with final?

14. What is the difference between interface and abstract class?

15. How many types of IO streams are there in Java?

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

17. What are the common methods of Files?

i

2. Container series interview questions

18. What are the Java containers?

19. What is the difference between Collection and Collections?

20. What is the difference between List, Set, Map?

21. What is the difference between HashMap and Hashtable?

22. How to decide to use HashMap or TreeMap?

23. Tell me about the implementation principle of HashMap?

24. Tell me about the implementation principle of HashSet?

25. What is the difference between ArrayList and LinkedList?

26. How to realize the conversion between array and List?

27. What is the difference between ArrayList and Vector?

28. What is the difference between Array and ArrayList?

29. What is the difference between poll() and remove() in Queue?

30. Which collection classes are thread safe?

31. What is iterator Iterator?

32. How to use Iterator? What are the characteristics?

33. What is the difference between Iterator and ListIterator?

34. How to ensure that a collection cannot be modified?

Three, multi-threaded series of interview questions

35. What is the difference between parallelism and concurrency?

36. What is the difference between thread and process?

37. What is a daemon thread?

38. What are the ways to create threads?

39. What is the difference between runnable and callable?

40. What are the states of a thread?

41. What is the difference between sleep() and wait()?

42. What is the difference between notify() and notifyAll()?

43. What is the difference between run() and start() of a thread?

44. What are the ways to create a thread pool?

45. What are the states of the thread pool?

46. ​​What is the difference between submit() and execute() methods in thread pool?

47. How to ensure the safety of multi-threaded operation in Java programs?

48. What is the principle of synchronized lock upgrade in multithreading?

49. What is deadlock?

50. How to prevent deadlock?

51. What is ThreadLocal? What are the usage scenarios?

52. Tell me about the underlying implementation principle of synchronized?

53. What is the difference between synchronized and volatile?

54. What is the difference between synchronized and Lock?

55. What is the difference between synchronized and ReentrantLock?

56. Tell me about the principle of atomic?

Fourth, reflection, object copy, Java Web interview questions

57. What is reflection?

58. What is Java serialization? When is serialization required?

59. What is a dynamic proxy? What are the applications?

60. How to implement dynamic proxy?

61. Why use cloning?

62. How to implement object cloning?

63. What is the difference between deep copy and shallow copy?

64. What is the difference between JSP and servlet?

65. What built-in objects does JSP have? What are the functions?

66. Tell me about the 4 scopes of JSP?

67. What is the difference between session and cookie?

68. Tell me about the working principle of session?

69. If the client prohibits cookies, can the session still be used?

70. What is the difference between spring mvc and struts?

71. How to avoid SQL injection?

72. What is an XSS attack and how to avoid it?

73. What is a CSRF attack and how to avoid it?

Five, exception, network, design pattern series of interview questions

74. What is the difference between throw and throws?

75. What is the difference between final, finally, and finalize?

76. Which part of try-catch-finally can be omitted?

77. In try-catch-finally, if there is a return in the catch, will finally still be executed?

78. What are the common exception classes?

79. What do the http response codes 301 and 302 represent? What's the difference?

80. What is the difference between forward and redirect?

81. Briefly describe the difference between tcp and udp?

82. Why does tcp need to shake hands three times, can't it be done twice? Why?

83. Tell me how the tcp sticky packet is generated?

84. What are the seven-layer models of OSI?

85. What is the difference between get and post requests?

86. How to achieve cross domain?

87. Tell me about the implementation principle of JSONP?

88. Tell me about the design patterns you are familiar with?

89. What is the difference between simple factory and abstract factory?

Six, Spring, Spring MVC, Spring Boot, Spring Cloud series of interview questions

90. Why use spring?

91. Explain what is aop?

92. Explain what is ioc?

93. What are the main modules of spring?

94. What are the commonly used injection methods in spring?

95. Are beans in spring thread-safe?

96. How many bean scopes does spring support?

97. What are the ways to automatically assemble beans in spring?

98. What are the implementation methods of spring transactions?

99. Tell me about spring transaction isolation?

100. Tell me about the running process of spring mvc?

101. What are the components of spring mvc?

102. What is the role of @RequestMapping?

103. What is the role of @Autowired?

104. What is spring boot?

105. Why use spring boot?

106. What is the core configuration file of spring boot?

107. What are the types of spring boot configuration files? What's the difference?

108. What are the ways of spring boot to achieve hot deployment?

109. What is the difference between jpa and hibernate?

110. What is spring cloud?

111. What is the function of spring cloud circuit breaker?

112. What are the core components of spring cloud?

Seven, Hibernate, MyBatis series of interview questions

113. Why use hibernate?

114. What is an ORM framework?

115. How to view the printed SQL statement on the console in hibernate?

116. How many query methods does hibernate have?

117. Can hibernate entity class be defined as final?

118. What is the difference between using Integer and int for mapping in hibernate?

119. How does hibernate work?

120. What is the difference between get() and load()?

121. Tell me about the caching mechanism of hibernate?

122. What are the states of hibernate objects?

123. What is the difference between getCurrentSession and openSession in hibernate?

124.Do hibernate entity classes have to have a parameterless constructor? Why?

125. What is the difference between #{} and #{} in MyBatis?

126. How many paging methods does MyBatis have?

127. Does RowBounds query all results at once? Why?

128. What is the difference between MyBatis logical paging and physical paging?

129. Does MyBatis support lazy loading? What is the principle of lazy loading?

130. Tell me about the first-level cache and second-level cache of MyBatis?

131. What are the differences between MyBatis and hibernate?

132. What Executors does MyBatis have?

133. What is the implementation principle of the MyBatis pagination plugin?

134. How does MyBatis write a custom plugin?

Eight, RabbitMQ, Kafka, Zookeeper series of interview questions

135. What are the usage scenarios of RabbitMQ?

136. What are the important roles of RabbitMQ?

137. What are the important components of RabbitMQ?

138. What is the role of vhost in RabbitMQ?

139. How are RabbitMQ messages sent?

140. How does RabbitMQ ensure the stability of messages?

141. How does RabbitMQ avoid message loss?

142. What are the conditions to ensure the success of message persistence?

143. What are the disadvantages of RabbitMQ persistence?

144. How many broadcast types does RabbitMQ have?

145. How does RabbitMQ implement a delayed message queue?

146. What is the use of RabbitMQ cluster?

147. What are the types of RabbitMQ nodes?

148. What issues should be paid attention to when building a RabbitMQ cluster?

149. Is each node of RabbitMQ a complete copy of other nodes? Why?

150. What happens if the only disk node in the RabbitMQ cluster crashes?

151. Does RabbitMQ have any requirements for the stop order of cluster nodes?

152. Can kafka be used independently of zookeeper? Why?

153. How many data retention strategies does kafka have?

154. Kafka is set to clear data for 7 days and 10G at the same time. By the fifth day, the message reached 10G. How will Kafka handle it at this time?

155. What will cause kafka to run slowly?

156. What should be paid attention to when using Kafka cluster?

157. What is zookeeper?

158. What functions does zookeeper have?

159. How many deployment modes does zookeeper have?

160. How does zookeeper ensure the state synchronization of master and slave nodes?

161. Why is there a master node in the cluster?

162. There are 3 servers in the cluster, one of the nodes is down, can zookeeper still be used at this time?

163. Tell me about the notification mechanism of zookeeper?

Nine, MySQL series interview questions

164. What are the three paradigms of the database?

165. There are a total of 7 pieces of data in an auto-increment table, delete the last 2 pieces of data, restart the MySQL database, and insert another piece of data, what is the id at this time?

166. How to get the current database version?

167. Tell me 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 and right join in MySQL?

171. How is the MySQL index implemented?

172. How to verify whether the MySQL index meets the requirements?

173. Tell me about the transaction isolation of the database?

174. Tell me about the engines commonly used in MySQL?

175. Tell me about MySQL's row locks and table locks?

176. Talk about optimistic locking and pessimistic locking?

177. What are the methods for troubleshooting MySQL problems?

178. How to optimize the performance of MySQL?

10. Redis series interview questions

179. What is Redis? What are the usage scenarios?

180. What are the functions of Redis?

181. What is the difference between Redis and memcache?

182. Why is Redis single-threaded?

183. What is cache penetration? How to deal with it?

184. What data types does Redis support?

185. What are the Java clients supported by Redis?

186. What is the difference between jedis and Redisson?

187. How to ensure the consistency of cache and database data?

188. How many ways are there for Redis persistence?

189. How does Redis implement distributed locks?

190. What are the defects of Redis distributed locks?

191. How does Redis do memory optimization

192. What are the Redis elimination strategies?

193. What are the common performance problems of Redis? How to solve it?

Eleven, JVM series interview questions

194. Tell me about the main components of the JVM? and its role?

195. Tell me about the JVM runtime data area?

195. Tell me about the JVM runtime data area?

196. Tell me about the difference between stacks?

197. What are queues and stacks? What's the difference?

198. What is the parental delegation model?

199. Tell me about the execution process of class loading?

200. How to judge whether the object can be recycled?

201. What are the reference types in Java?

202. Tell me what garbage collection algorithms does the JVM have?

203. Tell me what kind of garbage collectors does the JVM have?

204. Describe the CMS garbage collector in detail?

205. What are the new generation garbage collector and the old generation garbage collector? What's the difference?

206. Briefly describe how the generational garbage collector works?

207. Tell me about the tools for JVM tuning?

208. What are the commonly used JVM tuning parameters?

Summarize:

All interview questions are not static. The above interview questions are just for everyone to use as a reference. The most important thing is to increase the knowledge reserve for yourself and be prepared. The answers to the latest 200+ Java interview questions in 2020 shared above are compiled into PDF documents.

Follow the official account: Programmer Chasing Wind, reply [009] to obtain the above information.

 

Guess you like

Origin blog.csdn.net/Design407/article/details/109546639