A variable is an identifier that denotes the storage location.Variable is a fundamental unit of storage in Java. The variables are used in combination with identifiers, data types, operators and some value for initialization.
Variables
A
variable is an identifier that denotes the storage location.
Variable
is a fundamental unit of storage in Java. The variables are used in combination
with identifiers, data types, operators and some value for initialization. The
variables must be declared before its use. The syntax of variable declaration
will be -
data_type
name_of_variable [=initialization] [,=initialization][,...];
Following
are some rules for variable declaration -
• The
variable name should not with digits.
• No special character is allowed in identifier
except underscore.
• There should not be any blank space with the
identifier name.
• The
identifier name should not be a keyword.
• The identifier name should be meaningful.
For
Example:
int a,b;
char
m='a';
byte
k=12,p,t=22;
The
variables have a scope which defines their visibility and a lifetime.
Object Oriented Programming: Unit I: Introduction to OOP and Java : Tag: : Definition, initialization, declaration, Example | Java - Variables
Object Oriented Programming
CS3391 3rd Semester CSE Dept | 2021 Regulation | 3rd Semester CSE Dept 2021 Regulation
Discrete Mathematics
MA3354 3rd Semester CSE Dept | 2021 Regulation | 3rd Semester CSE Dept 2021 Regulation
Digital Principles and Computer Organization
CS3351 3rd Semester CSE Dept | 2021 Regulation | 3rd Semester CSE Dept 2021 Regulation
Foundation of Data Science
CS3352 3rd Semester CSE Dept | 2021 Regulation | 3rd Semester CSE Dept 2021 Regulation
Data Structure
CS3301 3rd Semester CSE Dept | 2021 Regulation | 3rd Semester CSE Dept 2021 Regulation
Object Oriented Programming
CS3391 3rd Semester CSE Dept | 2021 Regulation | 3rd Semester CSE Dept 2021 Regulation