Summary of the first JAVA program

1. The first JAVA program

1. Code

 public class HelloWorld{
    
    
   public static void main(String[] args){
    
    
      System.out.println("helloWorld");
   }
}

Two, summary

1.Java program writing-compiling-running process

Compile: Save the written java code in a source file ending with ".java"
Compile: Use the javac.exe command to compile the java source file. Format: javac source file. java (will generate one or more bytecode (.class) files, the file name is the same as the class name in the java source file.
Run: use java.exe command to explain and run our bytecode file .Format: java class name

2.class

Multiple classes can be declared in a java source file, but at most one class can be declared as public, and the class declared as public must have the same name as the source file

3. Annotation

1. Classification of annotations

     单行注释
     多行注释
     文档注释(java特有)

2. The role of annotations

  1,对代码解释说明,增强可读性
  2,测试所写的代码,编译以后生成的.class结尾的字节码文件不包含注释的信息
  3 文档注释:注释内容可以被javadoc所解析,生成一套以网页文件形式体现的该程序的说明文档
  格式:
     /**
     @author ***(指定java程序的作者)
     @version v1.0 (指定源文件的版本)
	 这是我的第一个java程序!
	 */

3. Output statement

   System.out.println();------------先输出数据,然后换行
   System.out.print();--------------只输出数据

Guess you like

Origin blog.csdn.net/xue_yun_xiang/article/details/108935846