java各型默认值

来源:互联网 发布:js 二维数组 indexof 编辑:程序博客网 时间:2024/06/06 09:40
package 第二次作业;                                       //Java包
public class 第五题 {                                     //类名
 static char zifu;                          //定义字符型,在主函数前定义,可不赋值
 static float duanzheng;                    //定义短整型
 private static double changzheng;                  //定义长整型
 private static boolean buer;                       //定义布尔型
 private static String zifuchuan;                   //定义字符串
 public static void main(String[]args) {          
  System.out.println("char默认值为"+zifu);
  System.out.println("float默认值为"+duanzheng);
  System.out.println("double默认值为"+changzheng);
  System.out.println("boolean默认值为"+buer);
  System.out.println("String默认值为"+zifuchuan);
 }
}
原创粉丝点击