学习Java第二天

学习Java第二天

1. 注释


public class hello,world {
  public static void main(String[] args) {
      //单行注释
      //输出一个hello,Wrold!
      System.out.println("hello,wrold!");
  }
}
/*sjdh
* dc
* dsc*/

2. 标识注意点

所有的标识字符都应以字母(A-Z或者a-z),美元符($),下划线(_) 开始

String Ahello = "lala";
String hello = "lala";
String $hello = "lala";
String _hello = "lala";
String Shello = "lala";

3.八个数据基本类型

public class Demo02 {
  public static void main(String[] args) {
      String a="hello";
      int num = 10;
      System.out.println(a);
      System.out.println(num);

      //八大基本数据类型
      int num1 = 10;
      byte num2 = 20;
      short num4 = 30;
      long num4 = 30L;//long类型要在数字后面加个l

      //小数:浮点数
      float num5 = 50.1F;//long类型要在数字后面加l
      double num6 = 3.151926..;

      //字符
      char name = 'a';
      //字符串,string不是关键字,类
      //string namea ="拉拉";

      //布尔值:是非
      // boolean flag = true;
      //booleon flog = false;

  }
}

 

posted @ 2021-02-22 00:31  小阿丁  阅读(33)  评论(0)    收藏  举报