Summary and Induction of JAVA interview questions of Niuke Network (1), Niuke java
Preface
Today, I saw an article on explaining the Spring framework in the Nuggets. The article mentioned Niu Ke's interview questions. As a result, I downloaded the Niuke web app and found that there are many interview questions. I picked out the java interview questions for a moment. Ten questions are a group of interview questions. After completing these questions, I found that I had many mistakes, most of which were basic questions. As the saying goes: the depth of the Foundation determines the height of the future. I feel that I have to sum up and summarize a wrong question. I just took this opportunity to review the missing knowledge points in the java learning process. At the same time, I also think that the theoretical knowledge is also very important. The theory influences the idea and supports the quality of code.
Incorrect question Induction
3rd questions
Write the image description here
This question is easy to go wrong without looking at it carefully. I think it is very simple and it must be 4. In fact, the correct answer is 10 because break is missing and cannot be jumped out.
Summary:
4th questions
Write the image description here
Summary:
Answer:
First, str0 and str1 are static constants stored in the permanent generation of heap memory. Str2 is also a new object, because the source code of substring is actually a new String object and is returned. str3 and str4 directly create new objects through the new operator. Str2, str3, and str4 are young generations stored in the heap zone. After Full GC, the memory of the old generation is cleared and recycled. If it is not a permanent generation, only the young generation is left. So the young generation is 5*3 = 15 characters
Finyan
Stick to keeping some missing basic knowledge points updated every day.
Join the study exchange group 569772982 to learn and exchange.