Posts

Showing posts with the label primitive data type

Primitive and reference data types in java

In the previous post we learnt about different types of operators in java. Now, we will learn about different data types in java. When you will start writing the java program, you should know about the available variables in java. The use of the variable is to reserve memory space to store values into it. That means when you declare the variable that occupies some space in memory to store values.   Reservation of the memory is depending on the variable type.   That are primitive and object/reference data types. Primitive Data Types:         The Java Programming Language is statically-types, which means that all data types must declare first first they can be used. There are eight primitive data types are supported by java. Byte: byte data type is 8-bit signed two's complement integer. Minimum value is -128 , maximum value is 127(inclusive) . default value is 0 . byte is mainly used to store data in large array's. Byte is four times smaller that a int .