Interview basic knowledge points

Interview basic knowledge points

One, Java basics

Basic data types, java syntax, data structures, algorithms, etc., these are the skills and knowledge that a qualified Java programmer must master.

Organize and recommend some learning websites and books: From beginner to advanced Java book     recommendations, 10 recommended websites that programmers often go to

Organize a basic Java interview questions: Java interview basic questions

2. Multithreading/high concurrency

2.1 concurrent concurrent package

  • volatile
  • lock
  • synchronized
  • wait

View another article in detail: java multithreading keywords volatile, lock, synchronized

2.2 Ways to create threads

1. Inherit Thread
2. Implement Runnable interface-no return value
3. Implement Callable interface-return object

2.3 Thread pool

ThreadPoolFactory:
1. newFixedThreadPool: a thread pool with an unfixed thread pool size, a thread pool with unlimited memory size
2. newShcledulThreadPool: a thread pool with a fixed length and a size that runs at regular intervals
3. newSingleThreadPool: a single-threaded thread pool, only one thread is created Thread pool
4, newCachedThreadPool: no core threads, infinite loop use of the originally created threads

View another article in detail: Java Concurrent Programming Summary 

Three, JVM articles

3.1 Memory model

Main memory: an area shared by all threads. The latest data read by each thread is obtained from the main memory.
Working memory: unique to each thread, each thread operates its own variables, etc., and then transfers to the main memory after the operation is completed Loading and writing to
java threads: items that all threads can execute in parallel

3.2 Memory management mechanism

Program counter: specific to the thread, the command line number indicator of the program running, such as the current position and the next position of the program.
Java heap: The largest memory area shared by all threads, usually the area where the object instance is initialized and stored, such as the memory area occupied by the object generated after the new Object object.
Method area: shared by all threads, the largest memory area except the java heap, usually storing class information, constants, static variables, instant compiled code, etc.
Java virtual machine stack: The virtual machine executes Java method services, the thread is private, and the life cycle is the same as the thread. Create stack frame: local variable table, operand stack, dynamic link, method export and other information.
Native method stack: The class library required by the virtual machine to execute the native method, such as the class library of the rt.jar package.
Runtime constant pool: part of the method area, the version, field, method, and interface of the class.

3.3 Class loading mechanism

  • load
  • verification
  • ready
  • Parsing
  • initialization

3.4 Garbage collection mechanism

3.4.1 Garbage Collector

serial collector---single-threaded collector
parNew collector---multi-threaded version of serial
serialOld collector---old generation of serialOld collector (used by virtual machine in Client mode)
parallelOld collector---mark Sorting algorithm 
parallel scavenge collector
cms collector---the shortest recovery pause time is the goal, B/S architecture, emphasizes service response speed, StopTheWorld
g1 collector

3.4.2 Young generation/Old permanent generation

3.5 Parental delegation model

The initial loading of each class is loaded by its parent class, not by himself.
Boot loader-bootstrapClassLoader
extension loader-extentionClassLoader
application loader-applicationClassLoader
custom loader

For example, the Object class in rt.jar is loaded by the top-level boot loader. If it is not the parent delegation model, that is, ordinary loading: then contradictions and conflicts will occur

View the JVM article in detail: JVM virtual machine in-depth understanding + GC recovery + class loading  and  JVM: GC algorithm and GC collector

Four, design patterns

Design patterns are basically a must in interviews. You do not need to master all the 23 basic design patterns, but you must master the basic common design patterns.

  • Singleton mode lazy man hungry man mode
  • Factory mode
  • Factory method pattern
  • Abstract factory pattern
  • Agency model
  • Decorative pattern
  • Builder mode
  • Observer mode

View the design patterns in detail: Java common design patterns

Five, Spring core

The knowledge of the Spring family provides great convenience for developers. It can also be said to be the note of Java programmers. Spring integration can bring a qualitative leap to the system framework.

Its core is mainly: Spring's core features are IOC and AOP, IOC (Inversion of Control), or "inversion of control"; AOP (Aspect-Oriented Programming), or "Aspect-Oriented Programming".

1.ioc/di Inversion of Control/Dependency Injection
The creation of objects is handed over to the spring container for management, which reduces the coupling between objects and is easy to expand

2.aop aspect programming

The full name is Aspect Orient Programming, that is, aspect-oriented programming. It is a supplement to OOP (Object Orient Programming) and is used to handle some cross-cutting services. Often used for log output, security control, etc.

View the Spring article in detail: 25 Spring knowledge points frequently asked in interviews
 

Six, distributed articles

As a mainstream development framework in recent years, distributed is also a must-have knowledge, mainly RPC (Dubbo), SpringBoot/SpringCloud two common mainstream frameworks. Major factories have also launched their own open source distributed frameworks, which can be described as a hundred flowers blooming.

6.1 SpringBoot principle and basic knowledge

@SpringBootApplication annotation
includes the following three:
@Configuration annotation, indicating that this class uses Spring's annotation method
@ComponentScan annotation to enable component scanning. When the annotation is used to mark other controllers or services, the component scanning annotation can be found and loaded into these applications The bean
@EnableAutoConfiuration annotations used up and down indicate the use of automatic configuration; such as autowired annotations, etc., automatically load the configured annotations.

View the SpringBoot introduction in detail: Comparison of Spring, SpringMVC and SpringBoot

6.2 Dubbo principle and basic knowledge

The basic structure of Dubbo:

  • Provider: Register the service with the registry and expose the party providing the service;
  • Service consumer Consumer: the party that registers the service with the registration center and obtains the service provider list to use, and the service consumer;
  • Register: The registration center for service registration and discovery;
  • Service Monitoring Center Monitor: A monitoring center that counts the number of service calls and call time;
  • Service container Container: Service running container.

View Dubbo articles in detail: Introduction to the basic principles of Dubbo

6.3 SpringCloud Microservice

SpringCloud is a complete set of microservice solutions, based on the Spring Boot framework. To be precise, it is not a framework, but a large container. It integrates the better microservice frameworks on the market, thus simplifying developers The amount of code.

  • Routing gateway
  • Configuration Center
  • Link tracking
  • Service fusing
  • Log
  • Service monitoring

View the distributed column in detail: Deep understanding of SpringCloud   and microservice construction and  the comparison between SpringCloud and Dubbo

Seven, the database

The importance of the database is self-evident, everything in the system is data, and the database is the container for data storage. There are mainly two types of databases: relational databases and non-relational databases. Relational databases are mainly Oracle and MySQL, and non-relational databases NoSQL are mongodb and redis.

  • Data model
  • Three paradigms of database
  • Database transaction
  • SQL injection
  • SQL statement
  • Storage engine
  • index
  • SQL optimization

View the database article in detail: database index (Oracle and Mysql) learning summary

Eight, MyBatis

MyBtis is an excellent persistence layer framework, which supports custom SQL, stored procedures and advanced mapping. MyBatis eliminates almost all JDBC code and the work of setting parameters and obtaining result sets. MyBatis can configure and map primitive types, interfaces and Java POJOs (Plain Old Java Objects) as records in the database through simple XML or annotations.

  • #{} and ${} symbols: When the # symbol is loaded in mybatis, will it be preprocessed into? , And then use stateMent's set method to perform SQL statement operations, which can effectively prevent SQL injection.
  • The $ character is a string replacement, directly replacing the value.
  • How does dao (mapper) perform SQL result query?
  • Mybatis will load it as mapperStateMent; after the mapper interface is loaded, it corresponds to the fully qualified name of the namespace in the xml configuration file; according to the interface name and interface method name of dao
  • The only one corresponds to a namespace, that is, the only key;

View related articles: SpringCloud+MyBatis paging processing (front-end and back-end separation)

Nine, message middleware/caching

Distributed plug-in technology is a technology that must be mastered in distributed development, including: message queue, distributed cache, sub-database and sub-table plug-ins, etc.

9.1 Common message queue

  • kafka
  • RabbitMq
  • RocketMq
  • ActiveMQ

View the message queue article in detail: Message middleware: Kafka, ActiveMQ, RabbitMQ, RocketMQ

9.2 Distributed cache

  • Redis
  • Memcached

View the Redis article in detail: Redis quick start  and  three modes of Redis: master-slave, sentinel, cluster

Ten, jdk source code

In addition to the above technical points, the interviewer will often ask you some knowledge of jdk source code at the end to see if you have usually studied the jdk source code. This is an important consideration for standard programmers, and it is also an evaluation of whether a programmer is in-depth The habit of thinking.

  • jdk1.8 
  • String
  • Object
  • Map
  • ArrayList
  • LinkedList
  • HashMap
  • ConcurrentHashMap

Check out a few source code articles: HashMap is all in use, do you really understand the principle?  And  ArrayList source code analysis  and  LinkedList source code analysis  and  comparison of ArrayList and LinkedList and  several simple Lambda expressions of JDK1.8

Eleven, Docker container cluster

The container is the packaging of software into standardized units for development, delivery, and deployment.

11.1 Container concept

  • A container image is a lightweight, executable, stand-alone software package that contains all the content needed for the software to run: code, runtime environment, system tools, system libraries, and settings.
  • Containerized software is suitable for applications based on Linux and Windows, and can run consistently in any environment.
  • Containers give software independence and protect it from external environmental differences (for example, development and rehearsal environments), thereby helping to reduce conflicts between teams running different software on the same infrastructure.

 

11.2 Docker thought

  • container
  • Standardization: ①Transportation method, ②Storage method, ③API interface
  • isolation

11.3 Docker features

  • Lightweight, multiple Docker containers running on a machine can share the operating system kernel of this machine; they can be started quickly and only take up very little computing and memory resources. The mirror is constructed through the file system layer and shares some common files. This will minimize disk usage and download images faster.
  • Standards, Docker containers are based on open standards and can run on all mainstream Linux versions, Microsoft Windows, and any infrastructure including VMs, bare metal servers, and clouds.
  • Security, the isolation that Docker gives applications is not limited to isolation from each other, but also independent of the underlying infrastructure. Docker provides the strongest isolation by default, so application problems are only the problem of a single container, and will not affect the entire machine.

12. Actual combat: LeetCode

For some first-line companies, especially when recruiting in schools, they will focus on your programming ability. Some even ask you to write code on the spot: quick sort, binary search, Yanghui triangle, binary tree traversal, etc. This requires not only mastering the basic data structures and algorithms, but also strong programming capabilities and on-the-spot performance. For your favorite company and position, you must be fully prepared before you go to the interview. LeetCode is recommended here. There are many algorithmic questions for you to practice. Many working big cows often exercise their algorithms and programming thinking on it, and they don’t forget to recharge their studies after working: learning without thinking is dying.

Guess you like

Origin blog.csdn.net/yucaifu1989/article/details/109338956