char的初始值_java从入门到放弃 各种数组的初始值?
生活随笔
收集整理的這篇文章主要介紹了
char的初始值_java从入门到放弃 各种数组的初始值?
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
byte 型數組元素默認初始值是 0
short 型數組元素的默認初始值是 0
int 型數組元素的默認初始值是 0
long 型數組元素的默認初始值是 0L
char 型數組元素的默認初始值是 .u.000
float 型數組元素的默認初始值是 0.0f
double 型數組元素的默認初始值是 0.0d
boolean 型數組元素的默認初始值是 false
———————————————
public class Test {public static void main(String[] args) {byte[] arr = new byte[2];short[] arr1 = new short[2];int[] arr2 = new int[2];long[] arr3 = new long[2];char[] arr4 = new char[2];float[] arr5 = new float[2];double[] arr6 = new double[2];boolean[] arr7 = new boolean[2];System.out.println("請勿轉載,知乎三角貓");System.out.println("byte"+"t"+arr[1]);System.out.println("short"+"t"+arr1[1]);System.out.println("int"+"t"+arr2[1]);System.out.println("long"+"t"+arr3[1]);System.out.println("char"+"t"+arr4[1]);System.out.println("float"+"t"+arr5[1]);System.out.println("double"+"t"+arr6[1]);System.out.println("boolean"+"t"+arr7[1]);}
}
運行結果
byte 0
short 0
int 0
long 0
char
float 0.0
double 0.0
boolean false
總結
以上是生活随笔為你收集整理的char的初始值_java从入门到放弃 各种数组的初始值?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 《秋池》第三句是什么
- 下一篇: java里class有什么用_安装JDK