关键字和数据类型

java 53个关键字和保留字

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

 

八大基本数据类型

public class Demo01 {
   public static void main(String[] args) {
       //八大基本数据类型
       //整数
       int num1 = 10; //最常用
       byte num2 = 20;
       short num3 = 30;
       long num4 = 30L; //long类型要在数字后面加个L

       //小数:浮点数
       float num5 = 50.1F; //float类型要在数字后面加个F
       double num6 = 3.141592653589793238462643;

       //字符类型
       char name = 'A';
       //字符串 String不是关键字,是一个类
       String name1 = "大小";

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

  }
}

 

posted @ 2021-08-12 16:37  简~~~  阅读(83)  评论(0)    收藏  举报