Fighting on the front line, rushing to the big factory, the interview summary after three years of Java programmer interview

Preface

Some time ago, I accompanied my colleagues who worked with me to the interview. The first stop was Shenzhen, the second stop was Shanghai, and the third stop was Hangzhou. I won’t say much about the company for the interview, as you know it is a first-tier company. Actually, I really didn’t plan to write this article. The main reason is that my memory is not very good. Besides, many people have recently asked about the latest interview questions in 2019. I really can’t answer them, and I’m afraid to avoid repeating the answers. Save yourself a little effort, and simply reply here in a unified manner. To be honest, although as an escort, I cannot go in for the interview together during the interview. After the interview, my colleague came out with his vague memory to slowly recall a few questions asked by HR at the time. The following is what I have compiled Although some interview questions are not very complete, they are almost a few questions that must be asked (the preface tells everyone that I will not write down the answers to the interview one by one. After all, the answers are different for different levels. It's up to everyone to slowly understand) There is only so much I can help. The following are the interview questions.

First stop: (Shenzhen)

  1. Multiple threads read and write at the same time, and the number of reader threads is much larger than that of writer threads. How do you think the problem of concurrency should be solved? What kind of lock would you choose to add?
  2. Does JAVA's AQS know what it is?
  3. Apart from the synchronized keyword, how do you ensure thread safety?
  4. When do you need to add the volatile keyword? Can it guarantee thread safety?
  5. If all the threads in the thread pool are busy and submit a new task, what will happen? After the queue is full, it is still busy, what will happen if I submit it again?
  6. How do you usually adjust the parameters of Tomcat itself?
  7. What is locked by the synchronized keyword? How is it represented in bytecode? What is the performance on objects in memory?
  8. Does the wait/notify/notifyAll method need to be included in the synchronized block? Why is that?
  9. How do you use ExecutorService in general? Is one for each service or one item? what is the benefit?

Second and third stop

Spring

  1. Have you used Spring's AOP? Is it used? How do you use it?
  2. If there are two different implementations for an interface, then how can Autowire have a specific implementation?
  3. Where is Spring's declarative transaction @Transaction annotation generally written? Will it be automatically rolled back if an exception is thrown? Is there a way to control not to trigger a rollback?
  4. If you want to execute your own logic after a certain bean is created and assembled, how can you implement it?
  5. SpringBoot is not put in the web container. Why can it run HTTP service?
  6. In SpringBoot, if you want to use a custom configuration file other than application.properties, what should you do?
  7. Can RequestMapping in SpringMVC specify GET and POST methods? How to specify?
  8. If SpringMVC wants to package the output Object (such as XXResult or XXResponse) as JSON output, what should be done?
  9. How to intercept SpringMVC exceptions, and then do custom processing, such as logging or packaging into JSON
  10. 1. The difference between struts1 and struts2
  11. The difference between .struts2 and springMVC
  12. Which jar packages need to be referenced in the spring framework, and the purpose of these jar packages
  13. The principle of springMVC
  14. The meaning of springMVC annotations
  15. The connection and difference between beanFactory and ApplicationContext in spring
  16. Several ways of spring injection
  17. How does spring realize things management
  18. Principles of springIOC and AOP
  19. How to use level 1 and level 2 cache in hibernate and the principle of difference
  20. The way of cyclic injection in spring

MySQL

  1. If there are a lot of data inserted into MYSQL, what method would you choose?
  2. If the query is slow, what is the first way you would think of? What is the index?
  3. If a single-column index is built and two columns are found when querying, will this single-column index be used?
  4. If an index containing multiple columns is built, and only the first column is used in the query, can this index be used? How about checking three columns?
  5. Continue to the question, if there is an i + 5 <100 after the where condition, will this index be used?
  6. How to see if a certain index is used?
  7. Does like %aaa% use an index? What about like aaa%?
  8. What is the difference between drop, truncate, and delete?
  9. How do you monitor the database? How do you troubleshoot slow SQL?
  10. Does your database support emoji expressions, and if not, how to do it?
  11. What is the amount of data in a single table of your database? Does the query performance begin to drop sharply at most times?
  12. The query is dead. What command do you want to find out the query process that is executed? After you find it out, will you usually do it?
  13. How is the separation of reads and writes done? How do you think the middleware will operate? What does this operation have to do with the transaction? 14. Have you ever done sub-library and sub-table? What is the online migration process like? How to make sure that the data is correct?
  14. MySQL commonly used commands
  15. What are the characteristics of things in the database?
  16. The use of JDBC?
  17. The difference between InnodB and MyISAM
  18. Why does MySQL use B+ trees as indexes?

JVM

  1. Which ones do you know or what GC strategies do you use online? What are its advantages and what scenarios are they suitable for?
  2. How many kinds of JAVA class loaders are included? What is the sub-relationship between them? What does the parental delegation mechanism mean? what is the benefit?
  3. How to customize a class loader? Which ones have you used or in what scenarios do you need a custom class loader?
  4. What are the parameters of the heap memory setting? 5. What data is stored in Perm Space? Will it cause OutOfMemory? 6. When doing gc, what is the order in which an object is moved in each Space in the memory?
  5. Have you encountered an OutOfMemory problem? How do you deal with this problem? What are the gains in the process?
  6. What changes will Perm Space have after 1.8? Is the MetaSpace size limit by default? Or what method will you use to specify the size?
  7. What is Jstack? What about Jstat? If the online program freezes periodically, you suspect that it may be caused by gc. How would you troubleshoot this problem? What part of the thread do you usually look at?
  8. Have you encountered StackOverFlow exceptions? Normally you guess under what circumstances will it be triggered? How to specify the stack size of a thread? How much do you write in general?

Multithreading

  1. What is a thread? 2) What is the difference between thread and process? 3) How to implement threading in Java? 4) Use Runnable or Thread? 6) What is the difference between the start() and run() methods in the Thread class? 7) What is the difference between CyclicBarrier and CountDownLatch in Java? 8) What is a volatile variable in Java? 9) What is the difference between synchronous collection and concurrent collection in Java? 10) How to avoid deadlock? 11) What is the difference between livelock and deadlock in Java? 12) What is the difference between synchronized and ReentrantLock in Java? 13) What is the concurrency of ConcurrentHashMap in Java? 14) How to create Immutable objects in Java? 15) What is the double check lock in singleton mode? 16) Write 3 multithreading best practices that you follow 17) How to avoid deadlocks?
  1. Common thread pool modes and usage scenarios of different thread pools

Netty

1. What is the difference between BIO, NIO and AIO? 2. What is the composition of NIO? 3. What are the characteristics of Netty? 4. Netty's threading model? 5. The reasons and solutions for TCP sticking/unpacking? 6. What kind of serialization protocols do you know? 7. How to choose serialization protocol? 8. What is Netty's zero-copy implementation? 9. What are the high performance of Netty? 10. NIOEventLoopGroup source code?

Redis

1. The difference between Redis and Memorycache?

2. Five data structures of Redis?

3. Progressive rehash process?

4. Rehash source code?

5. Persistence mechanism 6. Reaof source code?

7. Affairs and events

8. Master-slave replication

9. Startup process

10. Cluster

11. Redis's 6 data elimination strategies

12. Concurrent competition in redis?

Hadoop

1. What are the characteristics of HDFS?

2. How does the client read and write data from HDFS?

3. What is the file directory structure of HDFS?

4. What is the memory structure of the NameNode?

5. Restart optimization of NameNode?

6. How to use Git?

7. Use of Maven

Well, the interview questions here are almost finished. If you have understood all of the above interview questions and can answer them all, then I can tell you here, you are great, I will take it. If the above questions are not correct, and you still can’t answer them, then you can follow in my footsteps to receive the answers and benefits I have compiled. I will introduce the major systems I have summarized. There are also corresponding learning materials for Java engineering, High performance and distributed, high performance, explain the profound things in a simple way. Explanation of knowledge points such as performance tuning, Spring, MyBatis, Netty source code analysis, etc.

Like + comment, follow me and click here to receive it for free

The following are the major system diagrams I summarized:

1. Source code analysis

image.png

Two, distributed architecture

[External link image transfer failed. The source site may have an anti-leech link mechanism. It is recommended to save the image and upload it directly (img-FBRgr6Zz-1614069773949)(https://upload-images.jianshu.io/upload_images/22934207-57c4dbd5f0c90dbe?imageMogr2 /auto-orient/strip%7CimageView2/2/w/1240)]

Three, microservices

[External link image transfer failed. The source site may have an anti-leech link mechanism. It is recommended to save the image and upload it directly (img-nwChusH5-1614069773950)(https://upload-images.jianshu.io/upload_images/22934207-be5d1aaf0c6301c2.png ?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)]

Fourth, performance optimization

[External link image transfer failed. The source site may have an anti-leech link mechanism. It is recommended to save the image and upload it directly (img-khkzkKv6-1614069773953)(https://upload-images.jianshu.io/upload_images/22934207-840bcf61f25d1ea9?imageMogr2 /auto-orient/strip%7CimageView2/2/w/1240)]

Five, Java engineering

[External link image transfer failed. The source site may have an anti-leech link mechanism. It is recommended to save the image and upload it directly (img-c9O0c6FH-1614069773954)(https://upload-images.jianshu.io/upload_images/22934207-0c9b080b3e006042?imageMogr2 /auto-orient/strip%7CimageView2/2/w/1240)]

Corresponding architecture video (partial)

[External link image transfer failed. The source site may have an anti-leech link mechanism. It is recommended to save the image and upload it directly (img-kFM8b4eh-1614069773956)(https://upload-images.jianshu.io/upload_images/22934207-d7004f8f30e06100.png ?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)]

image.png

to sum up:

The above is what I want to write. I hope that the above content can help Java programmers who are in silent hardships, encounter bottle problems and don’t know what to do. There is only so much I can help you. The interview questions have been summarized. That's it, there is only so much I can help. I hope everyone will go well in the future work and interviews.

+Like+Follow me after comment Click here to receive it for free

Guess you like

Origin blog.csdn.net/weixin_47066028/article/details/113995281