Java program to print default value of all the data types

Default values of all primitive data types

class A
{
  static byte a;
  static short b;
  static int i;
  static long l;
  static float f;
  static double d;
  static char c;
  static boolean bl;
  
    public static void main(String args[])
     {
      System.out.println("Default value of all primitive datatypes:");
      System.out.println("Byte:"+a);
      System.out.println("short:"+b);
      System.out.println("int:"+i);
      System.out.println("long"+l);
      System.out.println("float"+f);
      System.out.println("Double:"+d);
      System.out.println("char:"+c);
      System.out.println("Boolean:"+bl);
      
     }
}

Comments