Summary of java interview questions (1)

foreword

  In today's computer industry, R&D personnel are still mainly based on java development, and the application of java is also very extensive. Especially for back-end developers, their knowledge requirements are relatively high, and it is difficult to get started. Therefore, during the interview process, various questions are asked. Therefore, when you are looking for a back-end R&D job, you must have a systematic grasp and understanding of Java-related knowledge. I joined the company's project team this week and was notified that an interview would be held. Therefore, I took the time to do a comprehensive and systematic review of the java interview. Therefore, I made a systematic arrangement of common Java interview questions, and made a summary of the frequently asked questions, hoping to be of some help to those who are looking for a Java backend or in the future. First of all, we will introduce the general module classification of java.

1. Introduction to the java back-end R&D interview module

  We generally divide the development foundation of java into: Java SE (that is, the basic part of Java), Java Web, and java framework (including the common SSM - spring+spring mvc+mybatis) and the more popular microservices in recent years (including Spring boot, spring cloud, middleware Eraka and message queue RabbitMQ, Zookeeper) and other data storage tools - mysql and redis, the last essential thing is the knowledge of jvm. The modules of the specific java interview as a mind map are as follows:

The specific interview questions

  Here is a list of relevant interview questions for you, there are no answers here. For those who need to participate in the interview, please test yourself first to see how many you can answer without looking at the answers. Get a rough idea of ​​what you have. However, the answer to each question is given in detail from the following article.

1. java foundation

  1. What is the difference between JDK and JRE?
  2. What is the difference between == and equals?
  3. . The hashCode() of the two objects is the same, then equals() must also be true, right?
  4. What does final do in java?
  5. What is Math.round(-1.5) equal to in java?
  6. Is String an underlying data type?
  7. What are the classes for manipulating 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 common methods of String class?
  11. Does an abstract class have to have abstract methods?
  12. What is the difference between a normal class and an abstract class?
  13. Can abstract classes be finalized?
  14. What is the difference between an interface and an abstract class?
  15. What are the types of IO streams in java?
  16. What is the difference between BIO, NIO, and AIO?
  17. What are the common methods of Files?

2, container

  1. What are the java containers?
  2. What is the difference between Collection and Collections?
  3. What is the difference between List, Set, Map?
  4. What is the difference between HashMap and Hashtable?
  5. How to decide whether to use HashMap or TreeMap?
  6. Tell me about the implementation principle of HashMap?
  7. Tell me about the implementation principle of HashSet?
  8. What is the difference between ArrayList and LinkedList?
  9. How to realize the conversion between Array and List?
  10. What is the difference between ArrayList and Vector?
  11. What is the difference between Array and ArrayList?
  12. What is the difference between poll() and remove() in Queue?
  13. Which collection classes are thread safe?
  14. What is Iterator?
  15. How is Iterator used? What are the characteristics?
  16. What is the difference between Iterator and ListIterator?
  17. How to ensure that a collection cannot be modified?

3. Multithreading

  1. What is the difference between parallel and concurrent?
  2. Difference between thread and process?
  3. What is a daemon thread?
  4. What are the ways to create a thread?
  5. What is the difference between runnable and callable?
  6. What are the states of the thread?
  7. What is the difference between sleep() and wait()?
  8. What is the difference between notify() and notifyAll()?
  9. What is the difference between run() and start() of a thread?
  10. What are the ways to create a thread pool?
  11. What are the states of the thread pool?
  12. What is the difference between submit() and execute() methods in a thread pool?
  13. How to ensure the safety of multi-threading in java program?
  14. What is the upgrade principle of multi-threaded lock?
  15. What is deadlock?
  16. How to prevent deadlock?
  17. What is ThreadLocal? What are the usage scenarios?
  18. Tell me about the underlying implementation principle of synchronized?
  19. What is the difference between synchronized and volatile?
  20. What is the difference between synchronized and Lock?
  21. What is the difference between synchronized and ReentrantLock?
  22. Tell me about the principle of atomic?

4. Reflection

  1. What is reflection?
  2. What is java serialization? When is serialization required?
  3. What is a dynamic proxy? What applications are there?
  4. How to achieve dynamic proxy?

5. Object copy

  1. Why use clone?
  2. How to implement object cloning?
  3. What is the difference between deep copy and shallow copy?

6、Java Web

  1. What is the difference between jsp and servlet?
  2. What are the built-in objects of jsp? What are the functions?
  3. Tell me about the 4 scopes of jsp?
  4. What is the difference between session and cookie?
  5. Talk about the working principle of session?
  6. If the client prohibits cookies, can the session still be used?
  7. What is the difference between spring mvc and struts?
  8. How to avoid sql injection?
  9. What is an XSS attack and how can it be avoided?
  10. What is a CSRF attack and how can it be avoided?

7. Abnormal

  1. What is the difference between throw and throws?
  2. What is the difference between final, finally, finalize?
  3. Which part of try-catch-finally can be omitted?
  4. In try-catch-finally, if the catch returns, will finally be executed?
  5. What are the common exception classes?

8. Network

  1. What do the http response codes 301 and 302 represent? What's the difference?
  2. What is the difference between forward and redirect?
  3. Briefly describe the difference between tcp and udp?
  4. Why does tcp need to shake hands three times, can't it be twice? Why?
  5. Tell me how the tcp sticky package is generated?
  6. What are the seven-layer models of OSI?
  7. What is the difference between get and post requests?
  8. How to achieve cross-domain?
  9. Tell me about the implementation principle of JSONP?

9. Design Patterns

  1. Tell me about the design patterns you are familiar with?
  2. What is the difference between simple factory and abstract factory?

10、Spring/Spring MVC

  1. Why use spring?
  2. Explain what aop is?
  3. Explain what is ioc?
  4. What are the main modules of spring?
  5. What are the common injection methods of spring?
  6. Are beans in spring thread safe?
  7. How many bean scopes does spring support?
  8. What are the ways for spring to autowire beans?
  9. What are the implementation methods of spring transactions?
  10. Talk about spring's transaction isolation?
  11. Tell me about the spring mvc running process?
  12. What are the components of spring mvc?
  13. What does @RequestMapping do?
  14. What does @Autowired do?

11、Spring Boot/Spring Cloud

  1. What is spring boot?
  2. Why use spring boot?
  3. What is the spring boot core configuration file?
  4. What are the types of spring boot configuration files? What's the difference between them?
  5. What are the ways for spring boot to achieve hot deployment?
  6. What is the difference between jpa and hibernate?
  7. What is spring cloud?
  8. What is the role of spring cloud circuit breaker?
  9. What are the core components of spring cloud?

12、Hibernate

  1. Why use hibernate?
  2. What is an ORM framework?
  3. How to view the printed sql statement in the console in hibernate?
  4. How many query methods does hibernate have?
  5. Can hibernate entity classes be defined as final?
  6. What is the difference between using Integer and int to do mapping in hibernate?
  7. How does hibernate work?
  8. What is the difference between get() and load()?
  9. Talk about the caching mechanism of hibernate?
  10. What are the states of hibernate objects?
  11. What is the difference between getCurrentSession and openSession in hibernate?
  12. Does hibernate entity class have to have a no-argument constructor? Why?

13、Mybatis

  1. What is the difference between #{} and ${} in mybatis?
  2. How many paging methods does mybatis have?
  3. Is RowBounds a one-time query for all results? Why?
  4. What is the difference between mybatis logical paging and physical paging?
  5. Does mybatis support lazy loading? What is the principle of lazy loading?
  6. Talk about the first level cache and second level cache of mybatis?
  7. What is the difference between mybatis and hibernate?
  8. What executors does mybatis have?
  9. What is the implementation principle of the mybatis paging plugin?
  10. How does mybatis write a custom plugin?

14、RabbitMQ

  1. What are the usage scenarios of rabbitmq?
  2. What are the important roles of rabbitmq?
  3. What are the important components of rabbitmq?
  4. What is the role of vhost in rabbitmq?
  5. How are rabbitmq messages sent?
  6. How does rabbitmq ensure the stability of messages?
  7. How does rabbitmq avoid message loss?
  8. What are the conditions for ensuring the success of message persistence?
  9. What are the disadvantages of rabbitmq persistence?
  10. How many broadcast types does rabbitmq have?
  11. How does rabbitmq implement delayed message queue?
  12. What is the use of rabbitmq cluster?
  13. What are the types of rabbitmq nodes?
  14. What issues need to be paid attention to when building a rabbitmq cluster?
  15. Is each node of rabbitmq a complete copy of other nodes? Why?
  16. What happens when the only disk node in a rabbitmq cluster crashes?
  17. Does rabbitmq have requirements on the order in which cluster nodes are stopped?

15、Kafka

  1. Can kafka be used separately from zookeeper? Why?
  2. How many data retention strategies does Kafka have?
  3. Kafka has set 7 days and 10G to clear data at the same time. By the fifth day, the message reaches 10G. What will Kafka do at this time?
  4. What can cause kafka to run slower?
  5. What should I pay attention to when using kafka cluster?

16、Zookeeper

  1. What is zookeeper?
  2. What are the functions of zookeeper?
  3. How many deployment modes does zookeeper have?
  4. How does zookeeper ensure that the state of the master and slave nodes is synchronized?
  5. Why is there a master node in a cluster?
  6. There are 3 servers in the cluster, and one of the nodes is down. Can zookeeper still be used at this time?
  7. Tell me about the notification mechanism of zookeeper?

17、MySql

  1. What are the three paradigms of database?
  2. 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?
  3. How to get the current database version?
  4. Tell me what ACID is?
  5. What is the difference between char and varchar?
  6. What is the difference between float and double?
  7. What is the difference between inner join, left join and right join of mysql?
  8. How is mysql index implemented?
  9. How to verify whether the mysql index meets the requirements?
  10. Talk about database transaction isolation?
  11. Tell me about the engine commonly used by mysql?
  12. Talk about mysql row locks and table locks?
  13. Talk about optimistic locking and pessimistic locking?
  14. What are the methods for mysql troubleshooting?
  15. How to do mysql performance optimization?

18、Redis

  1. what is redis? What are the usage scenarios?
  2. What are the functions of redis?
  3. What is the difference between redis and memecache?
  4. Why is redis single-threaded?
  5. What is cache penetration? How to deal with it?
  6. What data types does redis support?
  7. What are the java clients supported by redis?
  8. What is the difference between jedis and redisson?
  9. How to ensure the consistency of cache and database data?
  10. How many ways are there for redis persistence?
  11. How does redis implement distributed locks?
  12. What are the flaws of redis distributed locks?
  13. How does redis do memory optimization?
  14. What are the redis elimination strategies?
  15. What are the common performance problems of redis? How to solve it?

19、JVM

  1. Tell me about the main components of jvm? and its role?
  2. Talk about the jvm runtime data area?
  3. Tell me about the difference between stacks?
  4. What are queues and stacks? What's the difference?
  5. What is the parental delegation model?
  6. Tell me about the execution process of class loading?
  7. How to determine whether an object can be recycled?
  8. What are the reference types in java?
  9. Tell me what garbage collection algorithm does jvm have?
  10. Tell me what garbage collectors are available in jvm?
  11. Describe the CMS garbage collector in detail?
  12. What are the new generation garbage collectors and the old generation garbage collectors? What's the difference?
  13. Briefly describe how the generational garbage collector works?
  14. Talk about a tool for jvm tuning?
  15. What are the commonly used JVM tuning parameters?

Summarize

  The above are the common interview questions for Java back-end research and development in recent years. They are divided into 19 small modules. I hope everyone can read this question before participating in the written test and interview when looking for related jobs. Help, it cannot be said that these questions cover all knowledge points, but at least the important knowledge points of the back-end have been covered. Of course, we can also use it as a small self-test for daily java learning. The answer will be given to you gradually at the beginning of the next article. However, this part of the answer is based on my own understanding plus the understanding of most others, because my own understanding is inevitably biased. However, this is not a standard answer, so everyone who needs it must have a basic judgment before adopting it. If there are any mistakes, I hope you can give me more advice in the comment area. Of course, these are the knowledge points of back-end java development. We can also use these contents to guide colleagues who want to learn java development and avoid going the wrong way. This is a java technology stack and can also be used as a skill tree for learning. First of all It is the java foundation, followed by containers, exceptions, networks, java web; then to the database, the common framework of java to the final microservices and the learning of big data clusters and jvm. In short, whether it is an interview or a beginner, this article will be helpful to colleagues in the java direction. I hope everyone will study hard, work hard, live to old age, learn old, and continuously improve their skills. At the same time, I also hope that the friends who are looking for a job can find a satisfactory job! ! ! !

references

[1]. Java's most common 200+ interview questions: interview essentials

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324160565&siteId=291194637
Recommended