Home > Java > JavaBase > body text

What does a java source file consist of?

青灯夜游
Release: 2020-11-02 14:40:53
Original
13120 people have browsed it

Java source file is composed of three parts: the first part is the class or external structure, such as "class Student{}"; the second part is the main() method, also called the entry of the program; the third part Part of the code is written in the main method.

What does a java source file consist of?

(Video tutorial recommendation: java video tutorial)

Java source file is composed of three parts,

The first part is a class or external structure:

What does a java source file consist of?

Example:

class Student{
}
Copy after login

The second part It is the main method, also called the entrance of the program

There are three points that everyone needs to pay attention to when learning:

What does a java source file consist of?

What does a java source file consist of?

The third part is writing the code

There are three points that everyone needs to pay attention to here:

1. The current code is written in the main method ;

2. You can write as many statements as you like, and the statements end with an English semicolon;

3. Suggestion: Write one statement per line.

The final output statement,

System.out.print(“大小写字母、数字、汉字以及特殊符号,但是输出后不换行”);
System.out.println(“输出内容同上,但是输出后换行”);
Copy after login

There is another point that needs to be learned, that is, comments, the following two points:

1. Function: explanation, in the program It is not executed in the program, mainly to increase the readability of the program

2. Category:

单行注释//
多行注释/* 注释内容 */
文档注释/** 注释内容 */
Copy after login

For more programming-related knowledge, please visit: Programming Teaching! !

The above is the detailed content of What does a java source file consist of?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!