II B.Tech II Sem CSE Java Lab Exercise - 1a (Basics)

a) Displaying default value of all primitive data types

Aim: To write a JAVA program to display default value of all primitive data type of JAVA

Description:




Program:


class defaultdemo 
{
         static byte b;
         static short s;
         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("The default values of primitive data types are:");   
               System.out.println("Byte :"+b);
               System.out.println("Short :"+s);
               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);
        } 
}


Output:



No comments

Swayam NPTEL Programming in Java Programming Assignment July-2025 Week-1 and Week-2

Week 01 : Programming Assignment 1 Due on 2025-08-07, 23:59 IST Write a Java program to check if a given integer is “Positive” or “Negative”...