hello world

hello world!

  1. 新建Code(程序)文件夹

  2. 在Code中建立hello.java文件

  3. 使用enter打开

  4. 编写

  5.  public class hello{
    public static void main (String[] args) {
    System.out.print("Hello,World!");
    }
    }
  6. 路径:打开CMD进入Code路径(cd/d d: cd Code(程序))

  7. 编译:通过javac把Java文件编译成class文件(javac hello.java)编译完成就会出现hello.class文件

  8. 运行:最后通过Java运行(Java hello)【java 运行的是class文件这个省略了】就能看到Hello World!

image-20211205111128649

  1. 注意事项

    1. 注意单词大小写,Java大小写敏感

    2. ("XXXX")中尽量使用英文

    3. 文件名和类必须保持一致,首字母尽量大写

    4. 符号使用英文

 

代码

    public class hello{//public class{}是类    hello是类名
public static void main   /main是main方法/   (String[] args)/string[]是参数/ {
System.out.print("Hello,World!");/("")是输出/
}
}

 

posted @ 2021-12-05 11:33  教诲  阅读(46)  评论(0)    收藏  举报