day03

重要

  • psvm
  • sout

hello world

  1. 新建java文件》》》后缀名.java
  2. 编写代码
public class hello{
	public static void main(String[] args){
		System.out.print("hello,world!");
	}
}
  1. 进入所在文件cmd
  2. 转换class模式(编译)》(Javac 文件名)
  3. 打开代码 》(Java 文件名无后缀)
  4. 文件名和类名一样(public class 后名字)
  5. 使用英文符号

java基础语法

  1. 注释

    • 单行注释(//)
    • 多行注释(/* 注
    • 释 */)
    • 文档注释(/** 注释
    • */)
  2. 关键字

    abstract assert boolean break byte
    case carch char class const
    continue default do double else
    enum extends final finally float
    for goto if implements import
    instanceof int interface long native
    new package private protected public
    return stricftp short static super
    switch synchronize this throw throws
    transient try void volatile while

标识符

  1. 所有的标识符都应该以字母,美元符,或者下划线开始(_)
  2. 首字母后可以是字母,美元符,下划线
  3. 不能用表格内取名字
  4. 标识符大小写敏感

数据类型

基本数据类型

数值类型

  • 所有变量都必须先定义后才能使用
  • 整数类型byte

​ short

​ int

​ long 后要加L

  • 浮点类型float 后要加F

​ double

  • 字符(一个字)类型char

boolean类型

boolean flag = true

boolean flag = false

  • true

    false

    引用类型

posted @ 2021-10-10 17:56  阿尔达利安  阅读(35)  评论(0)    收藏  举报