Complete Works of 150 Questions in Java Interview! Receive for a limited time (including the answer to the question)!

The complete set of 170 questions in the Java interview!  Receive for a limited time (including the answer to the question)!

 

1. What are the characteristics of object-oriented?

2. What is the difference between the access modifiers public, private, protected, and not written (default)?

3. Is String the most basic data type?

4. Float f=3.4; is it correct?

5. Short s1 = 1; s1 = s1 + 1; is there any error? short s1 = 1; s1 += 1; is there any error?

6. Does Java have goto?

7. What is the difference between int and Integer?

8. The difference between & and &&?

9. Explain the usage of stack, heap and static area in memory.

10. How much is Math.round(11.5) equal to? What is Math.round(-11.5)?

11. Can switch be used on byte, long, and String?

12. Use the most efficient method to calculate 2 times 8?

13. Does the array have a length() method? Does String have a length() method?

14. How to break out of the current multiple nested loops in Java?

15. Can the constructor be overridden?

16. Two objects have the same value (x.equals(y) == true), but they can have different hash codes. Is this sentence correct?

17. Can the String class be inherited?

18. When an object is passed as a parameter to a method, the method can change the properties of the object and return the changed result. So, is it passed by value or by reference?

19. What is the difference between String and StringBuilder and StringBuffer?

20. The difference between Overload and Override. Can overloaded methods be distinguished based on the return type?

21. Describe the principle and mechanism of JVM loading class files?

22. Can a Chinese character be stored in a char variable? Why?

23. What are the similarities and differences between abstract class and interface?

24. What is the difference between Static Nested Class and Inner Class?

25. Will there be a memory leak in Java? Please describe briefly.

26. Can abstract methods be static at the same time, can they be native methods at the same time, and can they be modified by synchronized at the same time?

27. Explain the difference between static variables and instance variables.

28. Is it possible to call a non-static method from within a static method?

29. How to implement object cloning?

31. String s = new String("xyz"); How many string objects have been created?

32. Does the interface extend the interface? Can abstract classes implement interfaces? Can abstract classes inherit concrete classes?

33. Can a ".java" source file contain multiple classes (not internal classes)? What are the restrictions?

34. Can Anonymous Inner Class inherit from other classes? Can the interface be implemented?

35. Can an inner class refer to the members of its containing class (outer class)? Are there any restrictions?

36. What are the uses of the final keyword in Java?

38. Conversion between data types:

39. How to reverse and replace character strings?

40. How to convert GB2312 encoded string to ISO-8859-1 encoded string?

41. Date and time:

42. Print the current moment of yesterday.

43. Compare Java and JavaSciprt.

44. When to use assert?

45. What is the difference between Error and Exception?

46. ​​There is a return statement in try{}, so will the code in finally{} immediately after this try be executed, when is it executed, before or after return?

47. How does the Java language handle exceptions? How to use the keywords: throws, throw, try, catch, and finally?

48. What are the similarities and differences between runtime exceptions and checked exceptions?

49. List some of your common runtime exceptions?

50. Explain the difference between final, finally, and finalize.

51. The class ExampleA inherits Exception, and the class ExampleB inherits ExampleA.

What is the output of executing this code?

52. Do List, Set and Map inherit from Collection interface?

53. Explain the storage performance and characteristics of ArrayList, Vector, LinkedList.

54. What is the difference between Collection and Collections?

55. What are the characteristics of each of the three interfaces of List, Map, and Set when accessing elements?

56. How do TreeMap and TreeSet compare elements when sorting? How does the sort() method in the Collections utility class compare elements?

57. Both the sleep() method of the Thread class and the wait() method of the object can make the thread suspend execution. What is the difference between them?

58. What is the difference between sleep() method and yield() method of thread?

59. After a thread enters the synchronized method A of an object, can other threads enter the synchronized method B of this object?

60. Please tell me the methods related to thread synchronization and thread scheduling.

61. How many ways are there to write multithreaded programs?

62. How to use synchronized keyword?

63. Give examples of synchronous and asynchronous.

64. To start a thread, do you call the run() or start() method?

65. What is a thread pool?

66. The basic state of threads and the relationship between states?

67. Briefly describe the similarities and differences between synchronized and java.util.concurrent.locks.Lock?

68. How to realize serialization in Java and what is the significance?

69. How many types of streams are there in Java?

70. Write a method, enter a file name and a string, and count the number of times this string appears in the file.

71. How to list all files in a directory with Java code?

72. Use Java socket programming to implement a multi-threaded echo server.

73. How many forms of XML document definition? What is the essential difference between them? What are the ways to parse XML documents?

74. Where did you use XML in your project?

75. Explain the steps of JDBC operating database.

76. What is the difference between Statement and PreparedStatement? Which is better?

77. How to improve the performance of reading data when using JDBC to operate the database? How to improve the performance of updating data?

78. What is the role of the connection pool during database programming?

79. What is DAO mode?

80. What is the ACID of a transaction?

81. How to deal with transactions in JDBC?

82. Can JDBC handle Blob and Clob?

83. Briefly describe regular expressions and their uses.

84. How does Java support regular expression operations?

85. What are the ways to obtain the class object of a class?

86. How to create objects through reflection?

87. How to obtain and set the value of an object's private field through reflection?

88. How to call an object's method through reflection?

89. Briefly describe the object-oriented "six principles and one rule".

90. Briefly describe the design patterns you know.

91. Write a singleton class in Java.

92. What is UML?

93. What are the commonly used diagrams in UML?

94. Write a bubble sort in Java.

95. Write a binary search in Java.

96. Explain the difference between Servlet and CGI?

97. What methods are there in the Servlet interface?

98. What is the difference between forward and redirect?

99. What are the built-in objects of JSP? What are the roles?

100. The difference between get and post request?

101. What are the commonly used Web servers?

102. What is the relationship between JSP and Servlet?

103. Explain the four scopes in JSP.

104. How to realize the single thread mode of JSP or Servlet?

105. What are the technologies that implement session tracking?

106. What are the functions and usages of filters?

107. What are the functions and usages of the listener?

108. What can be configured in the web.xml file?

109. Which JSTL tags have been used in your project?

110. What are the benefits of using tag libraries? How to customize JSP tags?

111. Talk about the implicit objects of the expression language (EL) and their functions.

112. What operators does the expression language (EL) support?

113. What do Model 1 and Model 2 of Java Web development refer to?

114. What is the asynchronous processing in Servlet 3?

115. How to upload and download files in a Java-based Web project?

116. When the server receives the form data submitted by the user, does it call the doGet() or doPost() method of the Servlet?

117. What is the difference between static inclusion and dynamic inclusion in JSP?

118. How to obtain query parameters or form data submitted by users in Servlet?

119. How to obtain the initialization parameters configured by the user and the server context parameters in the Servlet?

120. How to set the request encoding and response content type?

121. Explain the mode and characteristics of network applications.

122. What is Web Service (Web Service)?

123. Concept explanation: SOAP, WSDL, UDDI.

124. What are the specifications related to Web Service in the Java specification?

125. Introduce the Web Service framework in the Java field you know.

126. What is ORM?

127. What are the issues to be considered in the design of the persistence layer? What persistence layer frameworks have you used?

128. Is SessionFactory thread safe in Hibernate? Is the session thread safe (can two threads share the same session)?

129. What is the difference between the load and get methods of Session in Hibernate?

130. What do the save(), update(), merge(), lock(), saveOrUpdate() and persist() methods of Session do? What's the difference?

131. Explain the process of Session loading entity objects.

132. What is the difference between the list method and iterate method of the Query interface?

133. How does Hibernate implement paging query?

134. What is the use of the lock mechanism? Briefly describe Hibernate's pessimistic and optimistic locking mechanisms.

135. Explain the three states and conversion relationships of the entity object.

136. How to understand Hibernate's lazy loading mechanism? In practical applications, how to deal with the contradiction between delayed loading and session closure?

137. Give an example of many-to-many association and explain how to implement many-to-many association mapping.

138. Talk about your understanding of inheritance mapping.

139. Briefly describe common optimization strategies of Hibernate.

140. Talk about Hibernate's primary cache, secondary cache and query cache.

141. What does the DetachedCriteria class in Hibernate do?

142. What is the function of the mappedBy attribute of the @OneToMany annotation?

143. What is the difference between using <code>#</code> and <code>$</code> to write placeholders in MyBatis?

144. Explain the role of namespace in MyBatis.

145. What does the dynamic SQL in MyBatis mean?

146. What are IoC and DI? How is DI implemented?

147. What are the scope of Bean in Spring?

148. Explain what AOP (Aspect Oriented Programming) is?

149. How do you understand the concept of "crosscutting attention"?

150. How do you understand the concepts of Joinpoint, Pointcut, Advice, Introduction, Weaving, and Aspect in AOP?

How to obtain answers to the above questions:

Add the assistant VX to reply "[java Interview Question]" to get the answer link!

Guess you like

Origin blog.csdn.net/a159357445566/article/details/108666835