Why We use Different Data Types

Different  Data Types Aik Efficent program likhna ka lya use ki jati ha . For Example Integer arithmetic , Floating Point sa zayada fast hoti ha Calculation ma .

Is lya agr ap double ya float value ni use karna chahta to ap simply int data type use kra ,fast Calculation ka lya .


 Harr Data Type memory consume karta ha . Our Harr data type different memory Consume karta ha . E.g Char C++ ma 1 byte our Java ma 2bytes consume karta ha our Int C++ ma 2 bytes our java ma 4 bytes consume karta ha .

To hum ya kahh sakta ha ka(in Java ) Double  8 byte consume karta ha jab-ka int 4 bytes . To isi sa pata chalta ha ka Different datatypes different memery consume karti ha , Chahye wo koi  be language ho . To agr hum Int data type ki jagha Double use kra to wo zayada memery consume kra ga .

In general , Harr Langauge bohot si built in data types  supply karta ha ,greatest flexibility ka lya .

Memory Consumed By Different Data Types In JAVA