Java - Tips - 01
How do you determine the size of primitive data types in JAVA? sizeof() operator in C is used to determine the size of its operand (memory (RAM) required) In JAVA, there is no sizeof() operator as in C Wrapper classes: It provides a way to use primitive data typesas objects Byte, Short, Integer, Long, Float, Double, Character and Boolean are the wrapper classes for the primitive data types byte, short, int, long, float, double, char and boolean respectively Except for the Boolean wrapper class, all other classes have SIZE and BYTES attributes The SIZE attribute determines the size of the data type in bits whereas, the BYTES returns the size of the datatype in bytes. Example: class DetermineSize { public static void main(String args[]) { System.out.println("size of byte (in bits)="+Byte.SIZE+" bits"); ...