Earlier, we have studied about the variable in mathematics. In mathematics,
variable denoted by an alphabet, represents a mathematical object e.g. a number,
a set, a vector, etc. Similarly, in programming a variable represents a data or
simply name of a memory location that is going to hold some data. You can
consider a variable is like a box in memory that can store some data. Unlike
mathematics, a variable name in java can be denoted by a single alphabet, or
any combination of alphabets, digits and two special characters i.e. under score
(_) and dollar sign ($). The variable name can not begin with a digit.
Q2. Explain the role of type in a variable.
Each variable is associated with a type that indicates the category of data
that particular variable is allowed to store. For example, in java, variables
of type int are allowed to store integer values, variables of
type float and double are used to store
real numbers, variables of type char is used to store
a character data.
Q3. What do you understand by programming paradigm ?
We have discussed that, variables, types, loops, branches and subroutines are
the basis of traditional programming. However, as programs become larger and
complex, programming paradigm is required to deal with the complexity.
Programming paradigm deals with organization of programming. In the present
context, we consider only two paradigms that manage the structure of the program:
process-oriented model
object-oriented model
In process-oriented model, programs are written around "what is happening" by
a series of linear steps. However, it is difficult to manage large and complex
programs through process-oriented model. In object-oriented model, programs are
written around "who is being affected and more priority is given to the data
used in the program. More details about object-oriented model is harder to
explain at this moment. So, we are going to provide the detail explanation
about object-oriented model in coming lectures.