DATA TYPES:
Data type is java is used to dictate the JVM what type of data will be stored in a variable during program execution and therefore allocate enough space for the variable.
Java data types are of two kinds:
Primitive or Fundamental
Reference or Composite
PRIMITIVE OR FUNDAMENTAL:
These data types, which form the part of java, are used to represent basic data values. This forms the fundamental data type that can be used and manipulated in java. Java provides 8 different primitive types. They are: byte, short, int, long, float, double, char and Boolean.
Primitive are four types:
- Integer primitive types
- Fractional primitive types
- Character primitive types
- Boolean primitive types
Reference or Composite data types:
Reference or composite data types are secondary types of data.It is composed or constructed using primitive data types. These may be a class, array or interface or string.
Variables:
The name given to a memory location where data is stored or needs to be stored is called variable.
Variable scope:
Scope or life time of a variable is only within the block enclosed within (braces) where it is declared.
0 comments:
Post a Comment