java文档注释和标题注释
Let’s start with simple Hello Poftut application. In application development comments are important because it provides clues about code. Comments are not included in code whiles compiling, interpreting or executing. They are just text can be read in code to give some hints. In java to mark comments //
and /* */
are used .For example in the following code italic part is just comment and not compiled with the application.
让我们从简单的Hello Poftut应用程序开始。 在应用程序开发中,注释非常重要,因为它提供了有关代码的线索。 在编译,解释或执行时,注释不包含在代码中。 它们只是文本,可以在代码中阅读以提供一些提示。 在Java中使用//
和/* */
标记注释。例如,在下面的代码中,斜体部分只是注释,而不是与应用程序一起编译。
public class HelloPoftut {
public static void main(String[] args) {
/*
Start of the app
*/
System.out.print("Hello Poftut");
//Prints Hello Poftut
}
}
public class HelloPoftut {
public static void main(String[] args) {
/*
Start of the app
*/
System.out.print("Hello Poftut");
//Prints Hello Poftut
}
}
Comments are important before beginning because we will use comments to explain code, take notes and similar things. Now actually above code is runnable simple java application. To execute is first we should compile the code. Here we can compile it with cli tool javac or use IDE to make all things. We use eclipse and compile it.
注释在开始之前很重要,因为我们将使用注释来解释代码,做笔记和类似的事情。 现在实际上上面的代码是可运行的简单Java应用程序。 首先要执行,我们应该编译代码。 在这里,我们可以使用cli工具javac对其进行编译,或者使用IDE进行所有处理。 我们使用eclipse进行编译。
区分大小写 (Case Sensitivity)
Java is case sensitive language which means using age with AGE is not the same even Age. Always be aware of that because it will give compilation errors.
Java是区分大小写的语言,这意味着使用Age和AGE甚至与Age都不相同。 请始终注意这一点,因为它会导致编译错误。
Age != age != AGE
年龄!=年龄!=年龄
In this application we focus on public static void main … line and below we will touch other parts later. When an application starts it will look for main method. Program execution instructions runs from top to down.
在此应用程序中,我们专注于公共静态void main…行,下面我们将介绍其他部分。 当应用程序启动时,它将寻找主要方法。 程序执行说明从上到下。
评论 (Comments)
Here
这里
/*
Start of the app
*/
1 2 3/*
Start of the app
*/
part is comment as stated before and compile operation removes them from executable file.
部分是如前所述的注释,编译操作将其从可执行文件中删除。
System.out.print("Hello Poftut");
1
System.out.print("Hello Poftut");
is real code runs when application starts. It simply prints “Hello Poftut”.
是在应用程序启动时运行的真实代码。 它仅打印“ Hello Poftut”。
Next line is comment to and we added it to explain previous line by simply saying “prints Hello Poftut”. Think it a message to other people that reads this code.
下一行是注释,我们通过简单地说“ prints Hello Poftut”将其添加到了上一行,以解释上一行。 认为这是给其他人阅读此代码的消息。
Java expressions end with ; . As you see in example generally all expression lines have ; . Expression is atomic struct to express something like data, operation etc.
Java表达式以;结尾。 如您在示例中看到的,通常所有表达式行都有; 。 表达式是表示数据,操作等内容的原子结构。
java文档注释和标题注释