Skip to main content

Posts

Showing posts from December, 2015

Data types in Java

Not everything in Java is an object. There is a special group of data types (also known as primitive types) that will be used quite often in programming. For performance reasons, the designers of the Java language decided to include these primitive types. Java determines the size of each primitive type. These sizes do not change from one operating system to another. This is one of the key features of the language that makes Java so portable. Java defines eight primitive types of data: byte, short, int, long, char, float, double, and boolean. 1) primitive data types 2) non-primitive data types Types Size Default Range Example boolean 1 bit false NA boolean b = true; Char 16 bits \u0000 \u0000 to \uFFFF char c = 'A'; Byte 8 bits 0 -128 to 127 byte b = 60; Short 16 bits ...