Java 배우기145 Questions and Exercises: Control Flow Statements Questions and Exercises: Control Flow StatementsQuestionsThe most basic control flow statement supported by the Java programming language is the ___ statement.The ___ statement allows for any number of possible execution paths.The ___ statement is similar to the while statement, but evaluates its expression at the ___ of the loop.How do you write an infinite loop using the for statement?How do y.. 2016. 1. 5. Summary of Control Flow Statements Summary of Control Flow Statements The if-then statement is the most basic of all the control flow statements. It tells your program to execute a certain section of code only if a particular test evaluates to true. The if-then-else statement provides a secondary path of execution when an "if" clause evaluates to false. Unlike if-then and if-then-else, the switch statement allows for any number o.. 2016. 1. 5. Branching Statements Branching StatementsThe break StatementThe break statement has two forms: labeled and unlabeled. You saw the unlabeled form in the previous discussion of the switch statement. You can also use an unlabeled break to terminate a for, while, or do-while loop, as shown in the following BreakDemo program:class BreakDemo { public static void main(String[] args) { int[] arrayOfInts = { 32, 87, 3, 589, .. 2016. 1. 5. The for Statement The for Statement The for statement provides a compact way to iterate over a range of values. Programmers often refer to it as the "for loop" because of the way in which it repeatedly loops until a particular condition is satisfied. The general form of the forstatement can be expressed as follows:for (initialization; termination; increment) { statement(s) } When using this version of the for sta.. 2016. 1. 5. The while and do-while Statements The while and do-while Statements The while statement continually executes a block of statements while a particular condition is true. Its syntax can be expressed as:while (expression) { statement(s) } The while statement evaluates expression, which must return a boolean value. If the expression evaluates to true, the while statement executes the statement(s) in the while block. The while statem.. 2016. 1. 5. The switch Statement The switch StatementUnlike if-then and if-then-else statements, the switch statement can have a number of possible execution paths. A switch works with the byte, short, char, and int primitive data types. It also works with enumerated types(discussed in Enum Types), the String class, and a few special classes that wrap certain primitive types: Character, Byte, Short, and Integer (discussed in Nu.. 2016. 1. 5. 이전 1 ··· 16 17 18 19 20 21 22 ··· 25 다음