Using accessors and mutators rather than simply making your variables public helps
because they can check that any change you make to your instance variables is
appropriate and they also warn the user of a problem.
Give this one a try later!
Purpose of accessors and mutators
, enables you to write a loop, where you know the number of iterations.
Syntax:
for(initialization; termination; update condition)
Give this one a try later!
For statement
Return statements are necessary if you are using a method that returns a value. A
method can only return one value, BUT the method can have more than one (like in
the case of an if-else statement, where there are two or more, but only one will get
executed based on the if statement).
Give this one a try later!
Return statement
1. Count-controlled: There is a count variable that increments every time the loop
iterates, and then the loop will terminate when the count equals a certain number.
2. ask-before iterating: This usually has a boolean statement and will proceed to
iterate through if the statement is true, and will terminate when the boolean is false.
Give this one a try later!
Types of controlling loops
because they can check that any change you make to your instance variables is
appropriate and they also warn the user of a problem.
Give this one a try later!
Purpose of accessors and mutators
, enables you to write a loop, where you know the number of iterations.
Syntax:
for(initialization; termination; update condition)
Give this one a try later!
For statement
Return statements are necessary if you are using a method that returns a value. A
method can only return one value, BUT the method can have more than one (like in
the case of an if-else statement, where there are two or more, but only one will get
executed based on the if statement).
Give this one a try later!
Return statement
1. Count-controlled: There is a count variable that increments every time the loop
iterates, and then the loop will terminate when the count equals a certain number.
2. ask-before iterating: This usually has a boolean statement and will proceed to
iterate through if the statement is true, and will terminate when the boolean is false.
Give this one a try later!
Types of controlling loops