Professional Documents
Culture Documents
CSN-103: Fundamentals of Object Oriented Programming: Indian Institute of Technology Roorkee
CSN-103: Fundamentals of Object Oriented Programming: Indian Institute of Technology Roorkee
CSN-103: Fundamentals of Object Oriented Programming: Indian Institute of Technology Roorkee
2
Constants and Variables
3
Java: Data Types and Variables
int x; // Declaration
x=10; // Initialization
– Incorrect
x=10; // Initialization without declaration
• Declaration for a variable can be done only once
4
Java: Data Types and Variables
5
Java: Data Types and Variables
6
Lexical Issues (Vocabulary in Java)
• Keywords: Reserved. Cannot be used as names for variables,
methods, and class