1字节 的 byte

2字节 的 char

精度 byte<short<char<int<long<float<double

随便打个整数默认为int

随便打个小数默认为double

低精度可以随便转高精度   char a='b';  int b=a

高精度变量赋值给低精度时候必须使用类型转换

int x=(int)322.42
long y=(long)3242.423f
int z=(int)34.342d

 输入时的兼容问题

int b=a.nextDouble();//false  高向低

double b=a.nextInt();

int b=a.nextShort();//低向高ok

运算时,按照精度高的算,精度低于int都算int


 

定义数组的方法有点不一样

int a[]=new int[3]

int a[][]=new int[3][ ]

int a[]

a=new int [3]

int a[]={123,324,324,234,235}

Student a[]=new Student[3];

数组的空间不可以改

        int a[]=new int[3];
        a[]=new int[4]

 

相关文章:

  • 2021-05-16
  • 2021-12-04
  • 2021-06-21
  • 2021-09-05
  • 2021-11-16
  • 2021-10-26
  • 2021-07-19
  • 2021-07-16
猜你喜欢
  • 2021-07-17
  • 2021-10-19
  • 2022-02-06
  • 2021-06-22
  • 2022-01-23
  • 2021-10-30
  • 2021-11-21
相关资源
相似解决方案