The best way to verify how well you have learned Java is to look at these interview questions, come on, and start to verify whether you are proficient or not.
Because there are too many words, only interview questions are given in categories, and the answer to each question is at the end of the article
One, Java basics
1. Explain what is object-oriented? What is the difference between object-oriented and process-oriented?
2. Three characteristics of object-oriented? Explain separately?
3. What is the relationship between JDK, JRE, and JVM?
4. What is the difference between overloading and rewriting?
5. Is it possible to override a private or static method in Java?
6. What are the characteristics of the construction method?
7. What is the effect of defining a construction method that does nothing and has no parameters in Java?
8. How many ways to create objects in Java?
9. What is the difference between abstract class and interface?
10. What is the difference between static variables and instance variables?
11, 12, short s1 = 1; s1 = s1 + 1; what's wrong? What about short s1 = 1; s1 += 1;? Are there any errors?
12. What is the difference between Integer and int?
13. The difference between boxing and unboxing
14. Can the switch statement be used on byte, on long, and on String?
The difference between 15, 16, final, finally, finalize
16. What is the difference between == and equals?
17. If the hashCode() of two objects is the same, then equals() must also be true?
18. Why rewrite equals() must rewrite hashCode() method?
19. The difference between & and &&?
20. What about passing values when passing parameters in Java? Or pass by reference?
21. How much is Math.round(-1.5) in Java?
22. How to realize the cloning of objects?
23. What is the difference between deep clone and shallow clone?
24. What is serialization in Java and how to realize serialization in Java?
25. Under what circumstances need serialization?
Two, Java generics and serialization
26. How does Java's generics work? What is type erasure?
27. What are the qualified wildcards and non-qualified wildcards in generics?
28. What is the difference between List and List?
Three, Java reflection
29. What does reflection in Java mean? What are the application scenarios?
30. What are the advantages and disadvantages of reflection?
31. What is a dynamic proxy in Java? What are the applications?
32. How to implement dynamic proxy?
Four, Java keywords
33. What does the static keyword do?
34. What is the role of the super keyword?
Five, Java exception
35. When is the code in the finally block executed?
36. Will finally be executed?
37. In try-catch-finally, if the catch is returned, will finally be executed?
38. Which part of try-catch-finally can be omitted?
39. What is the difference between Error and Exception?
40. What are the similarities and differences between runtime exceptions and checked exceptions?
41. What is the difference between throw and throws?
42. What are the common exception types?
43. Can the main thread catch the exception of the child thread?
Six, Java string
44. What is the difference between bytes and characters?
45. Why should String be designed as an immutable class?
46. What is the difference between String, StringBuilder and StringBuffer?
47. The principle of String modification?
48. Is String str = "i" the same as String str = new String("i")?
49. What are the commonly used methods of the String class?
50. Is it possible to append after final modification of StringBuffer?
Seven, Java files
51. Classification of IO streams in Java? Name a few implementation classes you are familiar with?
52. What is the difference between byte stream and character stream?
53. What is the difference between BIO, NIO and AIO?
8. Java collections (important)
54. What are the commonly used containers in Java?
55. What is the difference between ArrayList and LinkedList?
56. What role does ArrayList implement the RandomAccess interface? Why doesn't LinkedList implement this interface?
57. What is the expansion mechanism of ArrayList?
58. What is the difference between Array and ArrayList? When is it better to use Array?
59. The realization principle of HashMap/underlying data structure? JDK1.7 and JDK1.8
60. The execution process of the put method of HashMap?
61. The execution process of the get method of HashMap?
62. The execution process of the resize method of HashMap?
63. Why must the size of HashMap be an integer power of 2?
64. HashMap multi-thread infinite loop problem?
65. Can the get method of HashMap determine whether an element is in the map?
66. What is the difference between HashMap and HashTable?
67. What is the difference between HashMap and ConcurrentHashMap?
68. The difference between HashTable and ConcurrentHashMap?
69. What is the realization principle of ConcurrentHashMap?
70. The realization principle of HashSet?
71. How does HashSet ensure that elements are not repeated?
72. What is the implementation principle of LinkedHashMap?
73. How to use Iterator? What are the characteristics?
74. What is the difference between Iterator and ListIterator?
75. What is the difference between Iterator and Enumeration interfaces?
76. What is the difference between fail-fast and fail-safe?
77. What is the difference between Collection and Collections?
Nine, Java concurrency
78. What is the difference between parallel and concurrency?
79. The difference between thread and process?
80. What is a daemon thread?
81. Several ways to create threads?
82. What is the difference between Runnable and Callable?
83. Thread state and transition?
84. What is the difference between sleep() and wait()?
85. What is the difference between thread run() and start()?
86. How to ensure the safe operation of multiple threads in a Java program?
87. Several methods of Java thread synchronization?
88. What is the working principle of the Thread.interrupt() method?
89. Talk about the understanding of ThreadLocal?
90. In what scenarios will ThreadLocal be used?
91. Tell me about your understanding of the synchronized keyword?
92. How to use synchronized in the project?
93. Tell me what optimizations have been made at the bottom of the synchronized keyword after JDK1.6. Can you introduce these optimizations in detail?
94. Talk about the difference between synchronized and ReenTrantLock?
95. What is the difference between synchronized and volatile?
96. Talk about your understanding of the volatile keyword?
97. Tell me about the understanding of ReentrantReadWriteLock?
98. Tell me about the understanding of pessimistic lock and optimistic lock?
99. What are the two common implementations of optimistic locking?
100. What are the disadvantages of optimistic locking?
101. What are the usage scenarios of CAS and synchronized?
102. Simply talk about the understanding of atomic classes in Java?
103. What is the principle of atomic?
104. What is your understanding of the synchronizer AQS?
105. What is the principle of AQS?
106. What are the resource sharing modes of AQS?
107. The template method pattern is used at the bottom of AQS. Can you name a few methods that need to be rewritten?
108. Tell me about the understanding of the semaphore Semaphore?
109. What is the difference between CountDownLatch and CyclicBarrier?
110. Talk about your understanding of thread pools? Why use thread pool?
111. What are the parameters for creating a thread pool?
112. How to create a thread pool?
113. How to set the number of threads in the thread pool? What issues need to be considered?
114. What is the difference between the execute() method and the submit() method?
115. Tell me about your understanding of the Fork and Join parallel computing framework?
116. What concurrent containers are provided in the JDK?
117. Talk about the understanding of CopyOnWriteArrayList?
118. Talk about the understanding of BlockingQueue? What are the implementation classes?
119. Talk about your understanding of ConcurrentSkipListMap?
Ten, Java virtual machine
120. What are the main components of Jvm? And its role?
121. Talk about the understanding of the runtime data area?
122. What is the difference between heap and stack?
123. What is stored in the heap? What is stored in the stack?
124. Why distinguish between heap and stack? Isn't it possible to store data in the stack?
125. What about passing values when passing parameters in Java? Or pass by reference?
126. How is the size of a Java object calculated?
127. Two ways to access and locate objects?
128. What are the methods for judging that garbage can be recycled?
129. Where does garbage collection start?
130. Will the objects marked as garbage be recycled?
131. Talk about your understanding of references in Java?
132. Talk about your understanding of memory leaks?
133. What is the root cause of memory leaks?
134. Give some examples of possible memory leaks?
135. How to avoid memory leaks as much as possible?
136. What are the commonly used garbage collection algorithms?
137. Why use the generational collection algorithm?
138. What kind of garbage collection algorithm should be adopted for the young generation and the old generation under the generational collection?
139. What is floating garbage?
140. What is memory fragmentation? How to solve?
141. What are the commonly used garbage collectors?
142. Tell me about your understanding of the CMS garbage collector?
143. Tell me about your understanding of the G1 collector?
144. Tell me about your understanding of the garbage collection strategy / garbage collection timing?
145. Talk about your understanding of memory allocation? How to allocate large objects? Space allocation guarantee?
146. Tell me about the JVM monitoring tools you have used?
147. How to use monitoring tools for tuning?
148. Some parameters of JVM?
149. Tell me about your understanding of the class file structure? What are the components?
150. Tell me about your understanding of the class loading mechanism?
151. What are the roles of each stage of class loading?
152. What class loaders are there? What is the role of each?
153. The relationship between class and class loader?
154. Tell me about your understanding of the parental delegation model? work process? Why use
155. How to implement a custom class loader? What needs to be paid attention to?
156. How to break the parental delegation model?
157. What are the actual scenarios that need to break the parental delegation model?
158. Talk about your understanding of compile-time optimization and runtime optimization?
159. Why does the HotSpot virtual machine use an architecture where an interpreter and a compiler coexist?
160. Tell me about your understanding of the Java memory model?
161. What are the interactive operations between memories? What rules need to be met?
So, how do you learn Java? Anyway, after taking this interview question, my Java has gone to a higher level.
In order to make it easier for all the friends to review the interview questions that they don’t understand, the answers to these interview questions have been neatly organized into PDFs and sent to everyone for free. I only hope that everyone can use three links with one key
to show you the catalog and ensure that it is convenient for review.
Open the specific directory like this
Whether it’s for review, interview or to verify how well you learn Java, this interview question can definitely help you. You can reply to " Java Interview Questions " in the backstage of Shuidi 's public account " Shuidi Play Programming ". , You can get the PDF version of this interview question.
The other thing is, after everyone gets this interview question, try to look good, you are afraid that it will become the ash in your favorites, hehe.
In addition, if you want to see the online version, you can also go to Shuandi’s personal website: 100,000 Java Interview Questions to read online
Author: Hello everyone, I am Shuaidi. I have come from university and self-study all the way. I know the importance of algorithms and basic computer knowledge . The author of the public account " Handiplay Programming " has 100,000 fans. I specialize in writing these low-level knowledge and improve it. Our internal strength, handsomely look forward to your attention, study with me, click to understand my four-year university study road reprint instructions : without authorization, prohibit reprinting