The difficulty

primary

Learning time

Ten minutes

Suits the crowd

Zero basis

Development of language

Java

The development environment

  • JDK v11
  • IntelliJ IDEA v2018.3

1. What are comments?

Explain the code pairs.

2. Why do I need comments?

You probably knew what this code meant when you wrote it. But after a while, you might forget what this code means. At this point, you need to comment out the code. You can see it later when you look at this code with comments.

3. Annotations in Java

There are three types of annotations in Java:

Single-line comments

Multiline comment

Documentation comments

Next, we’ll take a look at each of the three annotations in turn.

4. One-line comments

Single-line comments start with “//”. Application in actual projects:

Single-line comments are used very often in real development, usually anywhere.

5. Multi-line comments

Multi-line comments start with “/*” and end with “*/”.

Multi-line comments are also used frequently in real development, often anywhere.

6. Document comments

Documentation notes start with “/**” and end with “*/”. Application in actual projects:

Documentation comments are also used frequently in real development, typically for classes or methods.

Note: for those of you who do not understand classes and methods, this will be explained in a later chapter.

Answering questions

If you have questions or want to learn more about cutting-edge technology, please leave them in the comments below, and I’ll answer them for you.

The previous chapter

“Full Stack 2019” Java Chapter 5: IntelliJ IDEA Code prompts automatically

The next chapter

“Full Stack 2019” Java Chapter 7: IntelliJ IDEA Annotation shortcuts

A study group

Join a synchronous learning group for mutual communication and progress.

  • Method 1: Follow the headline number gorhaf, private message “Java study Group”.
  • Method 2: follow the public account gorhaf, reply “Java learning group”.

Full stack engineer learning program

Follow us and join the “Full stack Engineer Learning Program”.

Copyright statement

Original is not easy, shall not be reproduced without permission!