Interviewed for half a year, summed up 1000 2023 Java architect job interview questions

Half a year ago, I was still confused about what to learn and how to get out of the current predicament. After half a year, I have successfully landed in Ali. Thanks to everyone who helped me during this period.

In the interview, 1000 classic Java interview questions were summarized, which included the key points of knowledge to be answered in the interview, and I classified them according to the type of knowledge, which can be said to be very comprehensive~

Basic

  • 1. What are the characteristics of the Java language

1. Easy to learn, rich class library 2. Object-oriented (the most important feature of Java, which makes the program less coupled and cohesive) 3. Platform-independent (JVM is the foundation of Java cross-platform use) 4. Reliable and safe 5. Support multi-threading

  • 2. The difference between object-oriented and process-oriented

Process-oriented: It is to analyze the steps to solve the problem, and then use functions to realize these steps step by step, and then call them one by one when using them. High performance, so single-chip microcomputer, embedded development, etc. generally adopt process-oriented development

Object-oriented: It is to decompose the transaction that constitutes the problem into various objects, and the purpose of establishing an object is not to complete each step, but to describe the behavior of a certain thing in the process of solving the entire problem. Object-oriented has the characteristics of encapsulation, inheritance, and polymorphism, so it is easy to maintain, reuse, and expand. Systems with low coupling can be designed. But in terms of performance, it is lower than process-oriented.

JVM articles

  • Talk about the difference between heap and stack

The stack is a runtime unit, representing logic, containing basic data types and object references in the heap, and the area is continuous without fragmentation; the heap is a storage unit, representing data, which can be shared by multiple stacks (including basic data types in members , references and reference objects), the area where they are located is discontinuous and there will be fragments.

1. Different functions Stack memory is used to store local variables and method calls, while heap memory is used to store objects in Java. Whether it is member variables, local variables, or class variables, the objects they point to are stored in heap memory.

2. Different sharing. Stack memory is private to threads. Heap memory is shared by all threads.

3. Different exception errors. If the stack memory or heap memory is insufficient, an exception will be thrown. Insufficient stack space: java.lang.StackOverFlowError. Insufficient heap space: java.lang.OutOfMemoryError.

4. Space size The space size of the stack is much smaller than that of the heap

Spring articles

  • 1. What is spring?

Spring is an open source development framework for java enterprise applications. Spring is mainly used to develop Java applications, but some extensions are aimed at building web applications for the J2EE platform. The goal of the Spring Framework is to simplify Java enterprise application development and promote good programming habits through a POJO-based programming model.

  • 2. Why do you use the Spring framework in your project?

If you ask this question, just talk about the benefits of the Spring framework. For example, Spring has the following characteristics:

Lightweight: Spring is lightweight, the basic version is about 2MB.

Inversion of Control: Spring achieves loose coupling through inversion of control, where objects give their dependencies rather than creating or finding dependent objects.

Aspect-Oriented Programming (AOP): Spring supports aspect-oriented programming and separates application business logic from system services.

Container: Spring contains and manages the lifecycle and configuration of objects in the application.

MVC framework: Spring's WEB framework is a well-designed framework and a good alternative to the Web framework.

Transaction management: Spring provides a continuous transaction management interface that can be extended from local transactions to global transactions (JTA)

Exception handling: Spring provides a convenient API to convert specific technology-related exceptions (such as those thrown by JDBC, Hibernate or JDO) into consistent unchecked exceptions.

MyBatis articles

SpringBoot articles

MySQL articles

  • Talk about the difference between InnoDB and MyISAM

  1. InnoDB supports transactions, but MyISAM does not. For InnoDB, each SQL language is encapsulated into a transaction by default and submitted automatically. This will affect the speed, so it is best to put multiple SQL languages ​​between begin and commit to form a transaction;

  2. InnoDB supports foreign keys, while MyISAM does not. Converting an InnoDB table containing foreign keys to MYISAM will fail;

  3. InnoDB is a clustered index, and the data file is tied to the index. It must have a primary key, and the efficiency of indexing through the primary key is very high. However, the auxiliary index requires two queries, the primary key is queried first, and then the data is queried through the primary key. Therefore, the primary key should not be too large, because if the primary key is too large, other indexes will also be large. MyISAM is a non-clustered index, the data file is separated, and the index stores the pointer of the data file. Primary key indexes and secondary indexes are independent.

  4. InnoDB does not save the specific number of rows in the table, and a full table scan is required when executing select count(*) from table. However, MyISAM uses a variable to save the number of rows in the entire table. When executing the above statement, you only need to read the variable, which is very fast;

  5. Innodb does not support full-text indexing, while MyISAM supports full-text indexing, and MyISAM has higher query efficiency;

SpringCloud 篇

Redis articles

  • Why is the Redis single-threaded model so efficient?

  1. C language implementation, high efficiency

  2. pure memory operation

  3. Based on non-blocking IO multiplexing model mechanism

  4. Single thread can avoid the frequent context switching problem of multithreading

  5. Rich data structure (the full name adopts hash structure, the reading speed is very fast, and some optimizations have been made on data storage, such as Yasuo table, jump table, etc.)

Partial display

Guess you like

Origin blog.csdn.net/csdn1234561231/article/details/131231982