The latest Java interview questions collected in October 2020 include detailed explanations on netty, spring, thread, spring cloud, etc.

Before the interview this year, I used a lot of information on the Internet for free prostitution. I also contacted some friends in major factories such as Ali and Tencent through offline methods. I got some internal interview questions. I manually summarized and subdivided 208 comparisons. The classic frequently asked interview questions and the answers have been sorted out. Now share them for free.

Some interview questions collected in the latest 2020 (all organized into documents), there are a lot of dry goods, including detailed explanations of netty, spring, thread, spring cloud, etc., there are also detailed learning plans, interview questions, etc. I feel that I am in the interview. Speaking very clearly: to get the interview information, just: click here to get it!!! Password: CSDNInsert picture description here

One, Java basics

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, equals must also be true, right?

4. What is the role of final in java?

5. How much is Math.round(-1.5) in java?

6. Is String a basic data type?

7. What are the classes of manipulation strings in java? What is the difference between them?

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

9. How to reverse the string?

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

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

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

13. Can abstract classes use final modification?

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

15. How many types of IO streams are 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 the java containers?

19. What is the difference between Collection and Collections?

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

21. What is the difference between HashMap and Hashtable?

22. How to decide whether 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?

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, multithreading

35. What is the difference between parallel and concurrency?

36. 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 statuses of threads?

41. What is the difference between sleep and wait?

42. What is the difference between notify and notifyAll?

43. What is the difference between thread run and start?

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

45. What are the statuses of the thread pool?

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

47. How to ensure the safe operation of multiple threads in a java program?

48. What is the upgrade principle of multithreaded locks?

49. What is a 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?

Four, reflection

57. What is reflection?

58. What is java serialization? Under what circumstances need serialization?

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

60. How to implement dynamic proxy?

Five, object copy

61. Why use clone?

62. How to implement object cloning?

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

Six, Java Web

What is the difference between 64.jsp and servlet?

What built-in objects does 65.jsp have? What are the roles?

66. What are the 4 scopes of jsp?

67. What is the difference between session and cookie?

68. Tell me about the working principle of session?

69. Can the session be used if the client prohibits cookies?

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

71. How to avoid sql injection?

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

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

Seven, abnormal

74. The difference between throw and throws?

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

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

77. In try-catch-finally, if the catch is returned, will finally be executed?

78. What are the common exception classes?

8. Network

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

80. The difference between forward and redirect?

81. Briefly describe the difference between tcp and udp?

82. Why does tcp need to shake hands for three times? why?

83. Talk about how tcp sticky packets are 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?

Nine, design patterns

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

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

十、Spring/Spring MVC

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 common injection methods of spring?

95. Are beans in spring thread safe?

96. What kind of bean scope does spring support?

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

98. What are the spring transaction implementation methods?

99. Talk 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?

十一、Spring Boot/Spring Cloud

104. What is spring boot?

105. Why use spring boot?

106. What is the spring boot core configuration file?

107. What types of spring boot configuration files are there? What is the difference between them?

108. What ways can spring boot 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?

Twelve, Hibernate

113. Why use hibernate?

114. What is the ORM framework?

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

116. 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. Tell me about hibernate's caching mechanism?

122. What are the statuses of hibernate objects?

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

124. Does hibernate entity class have to have a parameterless constructor? why?

13. Mybatis

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

126. How many paging methods does mybatis have?

127. Is RowBounds query all results at once? why?

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?

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

131. What are the differences between mybatis and hibernate?

132. What executors does mybatis have?

133. What is the realization principle of mybatis paging plug-in?

134. How does mybatis write a custom plug-in?

14. RabbitMQ

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's messages sent?

140. How does rabbitmq ensure the stability of the message?

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 types of broadcasts 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 constructing rabbitmq cluster?

149. Rabbitmq Is each node 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 stopping order of cluster nodes?

15. Kafka

152. Can kafka be used separately from zookeeper? why?

153. How many data retention strategies does Kafka have?

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

155. What conditions will cause Kafka to run slower?

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

16. Zookeeper

157. What is zookeeper?

158. What are the functions of zookeeper?

159. How many deployment modes does zookeeper have?

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

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

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

163. Tell me about the notification mechanism of zookeeper?

Seventeen, MySql

164. What are the three paradigms of the database?

165. There are a total of 7 pieces of data in an auto-increment table, the last 2 pieces of data are deleted, the mysql database is restarted, and another piece of data is inserted. What is the id at this time?

166. How to obtain the current database version?

167. What is ACID?

What is the difference between 168.char and varchar?

169. What is the difference between float and double?

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

171. How is the mysql index implemented?

172. How to verify whether the mysql index meets the demand?

173. Talk about the transaction isolation of the database?

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

175. Talk about the row lock and table lock of mysql?

176. Talk about optimistic locking and pessimistic locking?

177. What are the methods for mysql troubleshooting?

178. How to optimize the performance of mysql?

18. Redis

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

180. What are the functions of redis?

181. What is the difference between redis and memecache?

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

191. How does redis optimize memory?

192. What are the redis elimination strategies?

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

Nineteen, JVM

194. Tell me about the main components of jvm? And its role?

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 parent delegation model?

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

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

What are the reference types in 201.java?

202. Tell me about what garbage collection algorithms does jvm have?

203. Tell me about what garbage collectors jvm has?

204. Tell me more about the CMS garbage collector?

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

206. Briefly describe how the generational garbage collector works?

207. Tell me about the jvm tuning tool?

208. What are the commonly used jvm tuning parameters?

I will update several articles related to the interviews and common technology stacks of major Internet companies every week. Thank you very much for seeing this article. If this article is well written, please give me a thumbs up!

Guess you like

Origin blog.csdn.net/a646705816/article/details/109125214