Saturday, 3 January 2015

Java Data Types

Data types in Java can be broadly classified in two categories

1. Primitive data types / Simple data types
2. Non-primitive data types / Derived data types or Referenced data types

Primitive Data Types

Although java is an object oriented language, but the primitive data types are not objects. They are kept in java for performance reason. They form the basis for all other types of data that you define in your java programs.

The primitive data types may be further classified as:

1. Numeric data types

-- Integer data types - byte, short, int, long
-- Floating data types - float, double

2. Boolean data type - boolean

3. Character data type - char

Reference Data Types

Reference are also called derived data types as they are derived from the primitive data types. Reference data types can be further classified as:

1. Classes
   Built-in / Library classes
   User-Defined classes

2. Interfaces
   Built-in / Library classes
   User-Defined classes

3. Arrays

Array are treated as objects in Java, which is different from C++.

2 comments: