Data
type is a special keyword used to allocate sufficient memory space for the
data.
Categories of data types
1.
Fundamental
or primitive data types
2.
Derived
data types
3.
User
defined data types
1.
Primitive data types
Primitive data types are
those whose variables allows us to store only one value but they never allows
us to store multiple values of same type.
Example
int a; // valid
a=10; // valid
a=10, 20, 30; // invalid
We have eight Primitive data type which are organized in four
groups.
- Integer category data types
- Character category data types
- Float category data types
- Boolean category data types
1. Integer category data types
2. Character category data types
This data type takes two byte since it follows Unicode character
set.
3. Float category data
types
4. Boolean category data
types
2. Derived data types
Derived data types are those whose variables allow
us to store multiple values of same type. But they never allows to store
multiple values of different types.
Example
int a[] = {10,20,30}; // valid
int b[] = {100, 'A', "ABC"}; // invalid
3. User defined data types
User defined data type related variables allows us to store
multiple values either of same type or different type or both.
This is a data type whose variable can hold more than one value of
dissimilar type.
Example
Student s = new Student();
No comments:
Post a Comment