Ch02 Lecture03 ECEg3142 OOP 20181122-Introduction To Java Elements
Ch02 Lecture03 ECEg3142 OOP 20181122-Introduction To Java Elements
Structures
Tensay G. Kiflu
Department of Electrical and Computer Engineering (ECE)
Addis Ababa Science and Technology University(AASTU)
Variables
Variables are
created when their scope is entered
destroyed when their scope is left
This means that a variable will not hold its
value once it has gone out of scope.
Variables declared within a method will not
hold their values between calls to that
method.
Notice that x % y = 0 when y divides x perfectly; for example, 16 % 2 = 0. Also notice that x %
y = x when y is larger than x; for example, 23 % 25 = 23
Questions?