preface

Speaking of interview questions, update three questions every day, advocate daily accumulation rather than cramming, my purpose is not to memorize questions, but through this way to better consolidate their own knowledge.

The stars of the questions represent the difficulty level, the five stars are full, and I will list the pre-knowledge that needs to be mastered.

Everybody, duck!

What are the states of a thread and what is its life cycle? ⭐ ⭐

Objective: To investigate the basis of multithreading and concurrent programming

Pre-knowledge: Understand the java.lang.Thread class

When we create a new thread, it has just been created and the start() method has not yet been called, so it is in its initial state.

When the start() method is called, the thread is in a ready state, indicating that it is in the “ready” state. When the thread is selected to execute, it is called the running state. In Java, the ready and running states are collectively referred to as the running state.

If a thread is running and blocked by a lock, it will enter the blocked state, and when the lock is acquired, it will return to the ready state.

If a thread calls wait() on its own initiative, it enters a wait state, in which it must wait for another thread to wake it up. If we specify a timeout when we enter the wait state, it will enter the wait timeout state, and if no one wakes it up after this time, it will return to the ready state.

Finally, there is the terminated state, which indicates that the thread has finished executing.

What are the common project building tools, and what tools do you use to manage and build projects? ⭐

Purpose: To test the breadth of your knowledge, to see if you can just write code and not pay attention to the mundane

Prerequisite knowledge: None

Common project management tools include Maven and Gradle.

Maven is configured based on XML, while Gradle is configured using Groovy.

For now, we can use both. We can use Maven + Nexus private server to manage microservices, and we can use Gradle to manage standalone plug-in projects.

Is the Maven build lifecycle understood? ⭐ ⭐

Objective: Basic knowledge survey, commonplace things to see if you will understand its principle

Pre-knowledge: Maven tools

Maven has three standard life cycles to complete project builds:

  • Clean: Clears the files generated during the last build.
  • Build: Build the project.
  • Site: Create and publish project sites.

The so-called build lifecycle is the Build phase, which consists of the following components:

phase To deal with describe
Verify the validate Verify the project Verify that the project is correct and that all necessary information is available
Compile the compile compiling Source code compilation is completed at this stage
Test the Test test Run the tests using an appropriate unit testing framework, such as JUnit.
Packing package packaging Create JAR/WAR packages as mentioned in the pom.xml definition
Check the verify check The results of integration tests are checked to ensure that quality is met
Install the install The installation Install packaged items to a local repository for use by other projects
Deploy the deploy The deployment of Copy the final project package to a remote repository to share with other developers and projects

To be clear, the Maven life cycle in IDEA is listed for you, in the same order.

reference

Here I’ll put links to all of my references

  • Maven build lifecycle | novice tutorial (runoob.com)
  • Jetbrain IDEA