Unit-I Chapter in Book - 3 Data Types, Variables and Arrays: - K. Indhu
Unit-I Chapter in Book - 3 Data Types, Variables and Arrays: - K. Indhu
CHAPTER IN BOOK- 3
DATA TYPES, VARIABLES
AND ARRAYS
-K. Indhu
K. INDHU
GOALS
1. Why Java is strongly typed ?
2. Data Types in Java
3. Primitive Data Types in Java
4. Sample Program using Long
5. Sample Program using Double
6. Sample Program using Char
7. Sample Program using Boolean
8. Dynamic Initialization of Variables
9. Scope / Lifetime of Variables
10.Javas Type Conversions
11.Sample Program Type Conversion
12.Javas Type Promotion Rules
13.Single Dimensional Arrays
14.Multi Dimensional Arrays
K. INDHU
K. INDHU
K. INDHU
K. INDHU
K. INDHU
K. INDHU
K. INDHU
10
DYNAMIC INITIALIZATION OF
VARIABS
K. INDHU
11
SCOPE / LIFETIME OF
VARIABLES
K. INDHU
12
K. INDHU
13
K. INDHU
14
K. INDHU
15
The Type Promotion Rules are:1. All byte and short values are promoted to int.
2. If one operand is a long, the whole expression is
promoted to long.
3. If one operand is a float, the entire expression is
promoted to float.
4. If any of the operands is double, the result is double.
K. INDHU
16
K. INDHU
17
SAMPLE PROGRAM
K. INDHU
18
MULTI-DIMENSIONAL ARRAYS
K. INDHU
19
SAMPLE PROGRAM
K. INDHU
20
SAMPLE PROGRAM
DECLARATION- 3
DIMENSIONAL ARRAY
K. INDHU
21
ALTERNATE ARRAY
DECLARATION WAY
K. INDHU
22
SO FAR WE STUDIED
Data Types, Variables and Arrays
K. INDHU
23
HAPPY
LEARNING!!!