filmov
tv
Java program to find Size of all Data Types - Java Tutorial 09

Показать описание
Notes for You:: Java program to find Size of all Data Types - Java Tutorial 09
Data type:
- indicates type of data.
- also indicates the amount of memory to be allocated for a specific type of data.
There are 8 primitive types available in Java language.
1. byte : 08 bits - 1 byte
2. short : 16 bits - 2 bytes
3. int : 32 bits - 4 bytes
4. long : 64 bits - 8 bytes
5. float : 32 bits - 4 bytes
6. double : 64 bits - 8 bytes
7. char : 16 bits - 2 bytes
8. boolean : 1 bit
- To find and print size of any primitive data type; we take help its associated wrapper class.
- Inside each wrapper class (except Boolean type) there is a SIZE property; which returns the amount of memory being allocated for that specific type of data in bits.
Example Code:
package sizeofdatatypesdemo;
public class SizeofDatatypesDemo {
public static void main(String[] args) {
}
}
=========================================
Follow the link for next video:
Follow the link for previous video:
=========================================
Java Tutorials Playlist:-
=========================================
Watch My Other Useful Tutorials:-
C++ Tutorials Playlist:
C# Tutorials Playlist:-
C Programming Tutorials Playlist:
C Practical LAB Exercises Playlist:-
=========================================
► Subscribe to our YouTube channel:
► Visit our Website:
=========================================
Hash Tags:-
#ChidresTechTutorials #JAVA #JAVATutorial
Data type:
- indicates type of data.
- also indicates the amount of memory to be allocated for a specific type of data.
There are 8 primitive types available in Java language.
1. byte : 08 bits - 1 byte
2. short : 16 bits - 2 bytes
3. int : 32 bits - 4 bytes
4. long : 64 bits - 8 bytes
5. float : 32 bits - 4 bytes
6. double : 64 bits - 8 bytes
7. char : 16 bits - 2 bytes
8. boolean : 1 bit
- To find and print size of any primitive data type; we take help its associated wrapper class.
- Inside each wrapper class (except Boolean type) there is a SIZE property; which returns the amount of memory being allocated for that specific type of data in bits.
Example Code:
package sizeofdatatypesdemo;
public class SizeofDatatypesDemo {
public static void main(String[] args) {
}
}
=========================================
Follow the link for next video:
Follow the link for previous video:
=========================================
Java Tutorials Playlist:-
=========================================
Watch My Other Useful Tutorials:-
C++ Tutorials Playlist:
C# Tutorials Playlist:-
C Programming Tutorials Playlist:
C Practical LAB Exercises Playlist:-
=========================================
► Subscribe to our YouTube channel:
► Visit our Website:
=========================================
Hash Tags:-
#ChidresTechTutorials #JAVA #JAVATutorial
Комментарии