starting with java chapter 5

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

while loop

1. boolean expression that is tested for a true or false value 2. statement or block of statements that is repeated as long as the expression is true (repeats until boolean expression is false) pretest loop, which means that it tests its expression before each iteration

nested loop

a loop that is inside another loop

count-controlled loop

a loop that repeats a specific number of times

user-controlled loop

allows the user to decide he number of iterations

test expression

boolean expression that controls the execution of the loop

continue statement

causes a loop to stop its current iteration and begin the next one

break statement

causes a loop to terminate early

loop header

consists of the key word while followed by a boolean expression enclosed in parentheses

text file

contains plain text may be opened in a text editor such as Notepad

binary file

contains unformatted binary data, you cannot view its contents with a text editor

loop control variable

controls the number of times that the loop iterates

iteration

each repetition of a loop

conditional loop

executes as a long as a particular condition exists

update expression

executes at the end of each iteration

input file

file from which a program reads data

output file

file to which program writes data called an output file because the program stores output in the file

for loop

ideal for performing a known number of iterations pretest loop, tests its boolean expression before it performs an iteration

delimiter

item that separates other items

counter variable

keeps a count of the number of iterations

initialization expression

normally used to initialize a control variable to its starting value

postfix mode

operator is placed after the variable

prefix mode

operator is placed before the variable name

++ and--

operators that add and subtract one from their operands

loop

part of a program that repeats control structure that causes a statement or group of statements to repeat

the do-while loop

posttest loop ideal in situations where you always want the loop to iterate at least once

do-while loop

posttest loop, which means its boolean expression is tested after each iteration must be terminated with a semicolon

the while loop

pretest loop ideal in situation where you do not want the loop to iterate if the condition is false from the beginning. ideal if you want to use a sentinel value to terminate the loop

the for loop

pretest loop that has built-in expressions for initializing, testing, and updating these expressions make it very convenient to use a loop control variable as a counter. for loop is ideal in situations where the exact number of iterations is known

input validation

process of inspecting data given to a program by the user and determining if its valid

Java API

provides several classes that you can use for writing data to a file and reading data from a file

priming read

read operation that takes place just before the loop

exception

signal indicating that the program cannot continue until the unexpected event has been dealt with

buffer

small holding section of memory

read position

special value is internally maintained for that file

running total

sum of numbers that accumulates with each iteration

any method that uses a PrintWriter object must have a

throws IOException clause in its header

Scanner class and the File class

to read data from a file

PrintWriter class optionally FileWriter Class

to write data to a file

sentinel

value that signals when the end of a list of values has been reached

accumulator

variable used to keep the running total variable initialized with a starting value

can be used to create input routines that repeat until acceptable data is entered

while loop


Set pelajaran terkait

Network and Security Foundations

View Set

System Analysis & Design: Project Management - CH 3: The Project Management Process Groups -- QUIZ 3

View Set

6- Judgement and Decision Making (Egocentric and Confirmatory Biases)

View Set

CDV 440- Immigration: Exam 1 Article q's

View Set

Research Final Test (Study Guide One)

View Set

Chapter 26 Assessing Male genitalia and rectum

View Set