创新互联www.cdcxhl.cn八线动态BGP香港云服务器提供商,新人活动买多久送多久,划算不套路!

本篇文章为大家展示了在Java项目中使用char[]无法输出内存地址怎么解决,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。
前言
Java中共有八种基本数据类型:byte,int,short,long,float,double,char,boolean。
计算机中的基础数据单位是bit, 1byte=8bit。
| 数据类型 | 存储大小 | 举例 | 注释 | 包装类 |
|---|---|---|---|---|
| byte | 1byte | 3 | 字节 | Byte |
| int | 4byte | 4 | 整数 | Integer |
| short | 2bytes | 5 | 短整数 | Short |
| long | 8bytes | 6 | 长整数 | Long |
| float | 4bytes | 1.3 | 单精度浮点型 | Float |
| double | 8bytes | 1.2 | 双精度浮点型 | Double |
| char | 2bytes | ‘a' | 字符 | Char |
| boolean | 1bit | true | 布尔值 | Boolean |
这8种基本数据类型很简单,在示例中应用来看一下:
public class Test {
public static void main(String[] args){
System.out.println("8种基本数据类型");
int a=5;
System.out.println(a);
char b='z';
System.out.println(b);
boolean d=false;
System.out.println(d);
byte e=3;
System.out.println(e);
short f=4;
System.out.println(f);
long g=32000000;
System.out.println(g);
float h=5;
System.out.println(h);
double i=6;
System.out.println(i);
}
}