262
- a. What are the two major types of loops?
b.Distinguish between a count-controlled loop and an event-controlled loop.
c. What happens if you forget to increment the loop control variable in a
count-controlled loop?
d.What happens if you forget to change the event within the body of an event-
controlled loop?
e.Name three kinds of event-controlled loops.
21.Distinguish between an iteration counter and an event counter. - a. What is an assignment expression?
b.Write the assignment expression that can be used to control a reading loop
with the method readLine.
23.Which of the following, when passed as an argument to a method, can have its
value changed as a result of the method changing its parameters?
a.Variable of primitive type
b.Immutable object
c. Mutable object
24.What is a method called that changes the state of a mutable object?
Programming Warm-Up Exercises
1.Write the statements that associate an object of the class FileReaderwith the
file infile.dat.
2.Write the statements that associate an object of the class BufferedReaderwith
the file infile.dat.
3.Write the statements that associate an object of the class PrintWriterwith the
file outfile.dat.
4.What does the following series of statements write on the file fileOut?
fileOut.print(’W’);
fileOut.print(’\n’);
fileOut.print( 88 );
fileOut.print(’\n’);
fileOut.println(" This is a string.");
5.What is printed by the following series of statements?
fileOutPr.println(’W’);
fileOutPr.println( 88 );
fileOutPr.println(" This is a string");