I started to collect this interview list after I became a TeamLeader in 2015. On one hand, it is used for recruitment of the company, on the other hand, I want to use it to dig out my technical blind spots in Java technology stack, and then fix and improve it, so as to improve my technical level. Although I have been working on programming since 2009, I still feel that there is still a lot to learn. Of course, the learning process also brings me a lot of sense of accomplishment, which also pushes me to learn more technical knowledge.

Talk back to the interview questions in this matter, this interview list is our company’s internal use, originally can eventually have a lot of friends on WeChat to contact me, let me help them find some interview information, and these relationships are not too good to refuse, one, because they look for me, to the interview questions, is not my good friend, brother and sister, is my little brothers and sisters; Two, I can not be careless to deal with the matter of loyal people, I can not betray this trust. Slowly I came up with an idea, should I sort out the more than 200 interview questions to share out, to help more people in need.

To tell you the truth, I was hesitant at the beginning. First of all, I thought it would be a bit like cheating. Finally, I realized that it was worth doing.

  • First, let more people learn more knowledge, which is a good thing.
  • Second: It’s just a highly refined experience for people who already know the technology but don’t know how to express it, to learn how to present themselves in the interview.
  • Third: if it is just rote memorization of these interview questions, as long as the interviewer to further ask the correction, can also have an accurate understanding of the person, said before the “help people cheat” things exist.
  • Fourth: There are many ways to learn, but only a good scholar learns books. If it is people who do not want to learn, no matter how much good information is put in front of them, they will turn a blind eye.

Just like the story I’ve heard before, why do some companies in the United States accept you as long as you have a Harvard degree? It’s not that Harvard is so good, of course, the quality of teaching is also one of the reasons, but more because it’s quite expensive to go to university in the United States. First of all, if you can afford to go to Harvard, it means that your family is quite good, and you should have had many opportunities to attend better education when you were young. Second, you can get into Harvard, it also shows that you are not stupid, can get into Harvard; And finally, Harvard does provide you with a relatively good educational environment. That’s why companies are hiring people with Harvard degrees.

The same goes for this interview question. First of all, if you can remember most of the answers, you are smart and have a good memory. Second, it shows that you are self-motivated and willing to learn. Third, with this interview question to do theoretical support, even if your practical experience is not so much, but understand the principle of you, to make the procedure will not be too bad.

So if you’re the interviewer and you’re here, if you can, give a young, smart person who’s willing to learn more opportunities.

Interview questions module introduction

With that said, let’s get to the topic of this article, which is our interview question, which contains 19 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 in the figure below:

Perhaps for beginners do not need to look at the back of the framework and JVM module knowledge, readers can according to their own situation, choose the corresponding module to read.

Suitable for reading

  • Initial/intermediate/advanced Java programmers who need to be interviewed
  • Someone who wants to fill in the blanks
  • People who want to constantly improve and expand their Java technology stack
  • Java the interviewer

Specific interview questions

Let’s take a look at the 208 interview questions.

First, Java foundation

1. What’s the difference between JDK and JRE?

2. What’s the difference between == and equals?

3. Equals () must be true if two objects have the same hashCode(), right?

4. What role does Final play in Java?

What is the value of Math.round(-1.5) in Java?

6. Is String an underlying data type?

7. What classes are available for operation strings in Java? What’s the difference between them?

String STR =new String(” I “)

9. How do I reverse a string?

10. What are the common methods of String class?

11. Must abstract classes have abstract methods?

12. What are the differences between ordinary classes and abstract classes?

13. Can final be used on abstract classes?

What’s the difference between an interface and an abstract class?

15. How many IO streams are there in Java?

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

17. What are some common methods for Files?

Second, the container

18. What are the Java containers?

What’s the difference between Collection and Collections?

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

What’s the difference between a HashMap and a Hashtable?

22. How do I decide whether to use HashMap or TreeMap?

23. How does HashMap work?

24. How does HashSet work?

What’s the difference between an ArrayList and a LinkedList?

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

What is the difference between an ArrayList and a 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?

What is an Iterator?

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

What’s the difference between an Iterator and a ListIterator?

34. How do I ensure that a collection cannot be modified?

Three, multi-threading

35. What’s the difference between parallelism and concurrency?

36. What’s the difference between threads and processes?

37. What is a daemon thread?

38. What are several ways to create a thread?

39. What’s the difference between a runnable and a callable?

40. What are the states of threads?

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

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

43. What’s the difference between a thread’s run() and its start()?

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

45. What are the states of thread pools?

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

47. How to make multithreading safe in Java programs?

48. How does a multi-threaded lock upgrade work?

49. What is a deadlock?

50. How to prevent deadlocks?

51. What is a ThreadLocal? What are the use scenarios?

52. What is the underlying implementation of synchronized?

53. What is the difference between synchronized and volatile?

54. What’s the difference between synchronized and Lock?

55. 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 dynamic proxy? What are the applications?

60. How to implement dynamic proxy?

Object copy

61. Why use cloning?

62. How to implement object cloning?

63. What’s the difference between a deep copy and a shallow copy?

Six, Java Web

64. What’s the difference between JSP and servlet?

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

66. What are the four scopes of JSP?

67. What are the differences between sessions and cookies?

68. How does session work?

69. Can a client implement a session if it disables cookies?

What is the difference between Spring MVC and Struts?

How to avoid SQL injection?

72. What are XSS attacks and how can they be avoided?

73. What are CSRF attacks and how can they be avoided?

Seven, abnormal

74. What’s the difference between a throw and a throws?

What is the difference between final, finally and Finalize?

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

77. In a try-catch-finally, if a return is ina catch, will finally execute?

78. What are the common exception classes?

Eight, the network

79. What do THE HTTP response codes 301 and 302 represent? What’s the difference?

80. What’s the difference between “forward” and “redirect”?

What are the differences between TCP and UDP?

82. Why does TCP require three handshakes, but not two? Why is that?

83. How do TCP sticky packets come about?

84. What are the seven layers of the OSI model?

85. What are the differences between GET and POST requests?

86. How to achieve cross-domain?

87. How is JSONP implemented?

9. Design patterns

88. Describe a design pattern you are familiar with?

89. What’s the difference between a simple factory and an abstract factory?

Ten, Spring/Spring MVC

90. Why use Spring?

91. Explain what AOP is?

92. Explain what ioc is?

93. What are the main modules of Spring?

94. What are the common injection methods of Spring?

95. Are Beans in Spring thread-safe?

96. How many bean scopes does Spring support?

97. What are the ways in which Spring can auto-assemble beans?

What are the spring transaction implementations?

99. What about Transaction isolation in Spring?

100. What about the Spring MVC running process?

101. What are the components of Spring MVC?

What’s the use of 102.@RequestMapping?

What’s the use of 103.@Autowired?

Spring Boot/Spring Cloud

104. What is Spring Boot?

105. Why use Spring Boot?

What is the Spring Boot core configuration file?

107. What are the types of Spring Boot configuration files? What’s the difference?

108. What are the ways to implement hot deployment in Spring Boot?

109. What is the difference between JPA and Hibernate?

110. What is Spring Cloud?

111. What is the role of spring Cloud Circuit breaker?

112. What are the core components of Spring Cloud?

Twelve, Hibernate

113. Why use Hibernate?

114. What is the 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?

What’s the difference between get() and load()?

121. What about Hibernate’s caching mechanism?

What states do Hibernate objects have?

What is the difference between getCurrentSession and openSession in Hibernate?

124. Must Hibernate entity classes have parameterless constructors? Why is that?

13, Mybatis

What is the difference between #{} and ${} in mybatis?

126. How many paging methods does Mybatis have?

127. Do RowBounds query all results at once? Why is that?

128. What is the difference between myBatis logical pages and physical pages?

Does Mybatis support lazy loading? What is the principle of lazy loading?

What is the level 1 cache and level 2 cache of MyBatis?

131. What are the differences between Mybatis and Hibernate?

132. What executors does MyBatis have?

133. How does myBatis implement paging?

How to write a custom plug-in for Mybatis?

14, the RabbitMQ

135. What are the scenarios for using RabbitMQ?

136. What are the important roles in 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 message stability?

141. How to avoid message loss in RabbitMQ?

142. What are the conditions for successful message persistence?

143. What are the disadvantages of RabbitMQ persistence?

144. How many broadcast types are there in RabbitMQ?

145. How does RabbitMQ implement delayed message queuing?

146. What is a RabbitMQ cluster for?

147. What are the types of RabbitMQ nodes?

148. What issues should I pay attention to when setting up a RabbitMQ cluster?

149. Is each RabbitMQ node a full copy of the others? Why is that?

150. What happens when a single disk node in a RabbitMQ cluster crashes?

151. Does RabbitMQ require the stopping order of cluster nodes?

15, Kafka

152. Can Kafka be used separately from ZooKeeper? Why is that?

153. How many data retention strategies does Kafka have?

154. Kafka sets both 7 days and 10 gigabytes of data to clear. On day 5, the number of messages reaches 10 gigabytes.

155. What causes Kafka to run slower?

156. What should I pay attention to when using a Kafka cluster?

16, a Zookeeper

157. What is Zookeeper?

What are the functions of ZooKeeper?

159. How many deployment modes are there for ZooKeeper?

160. How does ZooKeeper ensure that the status of the primary and secondary nodes is synchronized?

161. Why does a cluster have a primary node?

162. Is ZooKeeper still available when one of the three servers in the cluster is down?

163. What about zooKeeper’s notification mechanism?

The 17th and MySql

164. What are the three paradigms of a database?

Select * from mysql where id = 1; select * from mysql where id = 1;

166. How do I obtain the current database version?

167. What is ACID?

168. What is the difference between char and varchar?

169. What’s the difference between float and double?

170. What is the difference between inner connection, left connection and right connection?

171. How is the mysql index implemented?

172. How to verify that the mysql index meets the requirements?

173. What about database transaction isolation?

174. What are the common engines used by mysql?

175. What about mysql row locks and table locks?

176. What about optimistic locks and pessimistic locks?

177. What are the methods to troubleshoot mysql problems?

178. How to optimize mysql performance?

Eighteen, Redis

179. What is Redis? What are the scenarios?

180. What are the functions of Redis?

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 are supported by Redis?

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 locking?

190. What are the drawbacks of redis distributed locks?

191. How does Redis optimize memory?

192. What are redis’ elimination strategies?

193. What are some common performance problems in Redis? How to solve it?

In the 19th, the JVM

194. What are the main components of the JVM? And what does it do?

195. What about the JVM runtime data area?

196. What’s the difference between stacks?

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

198. What is the parent delegation model?

199. What about the class loading process?

200. How do I determine whether an object can be reclaimed?

201. What reference types are available in Java?

202. What are the JVM’s garbage collection algorithms?

203. What garbage collectors does the JVM have?

204. What is the CMS garbage collector in detail?

205. What are the new generation garbage collectors and the old generation garbage collectors? What’s the difference?

206. Describe how the generational garbage collector works.

207. What about JVM tuning tools?

208. What are the common JVM tuning parameters?

Answers to the interview

Scan the qr code below to get the answer + question analysis + case code ↓↓↓