Understanding Conditional Statements and Loops in Java

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/115

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

116 Terms

1
New cards

If Statement

Executes code for the first true condition.

2
New cards

Else If Statement

Follows an if statement for additional conditions.

3
New cards

Else Statement

Executes if all previous conditions are false.

4
New cards

Boolean Expression

Evaluates to true or false.

5
New cards

Relational Operator

Compares values: <, <=, >, >=, ==, !=.

6
New cards

Boolean Method

Returns a boolean value from a method.

7
New cards

Boolean Variable

Stores a true or false value.

8
New cards

AND Operator

Combines expressions; all must be true.

9
New cards

OR Operator

Combines expressions; any can be true.

10
New cards

NOT Operator

Inverts the boolean value of an expression.

11
New cards

Short-Circuit Evaluation

Stops evaluating if the result is determined.

12
New cards

Division by Zero

Causes a program crash if unchecked.

13
New cards

Conditional Statement

Combines boolean expressions for decision making.

14
New cards

Parentheses in Conditions

Clarifies order of evaluation in expressions.

15
New cards

Chained Conditions

Multiple conditions linked with AND/OR operators.

16
New cards

True Condition

A condition that evaluates to true.

17
New cards

False Condition

A condition that evaluates to false.

18
New cards

Expression Evaluation Order

Checks from innermost to outermost parentheses.

19
New cards

Boolean Logic

Rules for combining true/false values.

20
New cards

Safe Division

Checks conditions to prevent division errors.

21
New cards

Conditional Execution

Runs code based on boolean evaluations.

22
New cards

Logical Operators

Operators that manipulate boolean values.

23
New cards

Expression Grouping

Using parentheses to control evaluation sequence.

24
New cards

Conditional Statement

A statement with one or more boolean expressions.

25
New cards

Boolean Expression

An expression that evaluates to true or false.

26
New cards

OR Operator (||)

True if at least one expression is true.

27
New cards

AND Operator (&&)

True only if all expressions are true.

28
New cards

Negation Operator (!)

Inverts the boolean value of an expression.

29
New cards

Parentheses in Conditions

Used for clarity in complex boolean expressions.

30
New cards

While Loop

Executes code block while condition is true.

31
New cards

Infinite Loop

A loop that never terminates.

32
New cards

Do-While Loop

Executes code block at least once before checking condition.

33
New cards

For Loop

Combines initialization, condition, and iteration in one line.

34
New cards

Loop Condition

The boolean expression that controls loop execution.

35
New cards

Code Block

The set of statements executed in a loop.

36
New cards

Variable Scope in For Loop

Count variable exists only within the loop.

37
New cards

Semicolon in While Loop

Should not be placed at the end of the statement.

38
New cards

Semicolon in Do-While Loop

Must be placed at the end of the while statement.

39
New cards

Loop Iteration

The process of executing the loop's code block.

40
New cards

Boolean Statement

A statement that results in a boolean value.

41
New cards

Condition Evaluation

The process of checking if a condition is true.

42
New cards

Readability in Code

Using parentheses improves code clarity and debugging.

43
New cards

Code Debugging

The process of identifying and fixing errors in code.

44
New cards

Variable Initialization

Setting a variable's initial value before use.

45
New cards

Control Flow

The order in which individual statements are executed.

46
New cards

Loop Execution

The repeated execution of a block of code.

47
New cards

Variable Name

Indicates the purpose of the variable.

48
New cards

For Loop

Repeats code while the condition is true.

49
New cards

Conditional Statement

Evaluates to determine loop execution.

50
New cards

Iterator

Changes variable value each loop iteration.

51
New cards

Increment Operator

Increases value by 1, e.g., ++.

52
New cards

Decrement Operator

Decreases value by 1, e.g., --.

53
New cards

Custom Iteration

Use +=, -=, *=, /= for different increments.

54
New cards

Infinite Loop

Occurs if condition never becomes false.

55
New cards

Forever Loop

Created with two semicolons in for loop.

56
New cards

While Loop

Ideal when loop end is unpredictable.

57
New cards

Do-While Loop

Executes code block before condition check.

58
New cards

Main Method

Manages program, calls other methods.

59
New cards

Method Declaration

Defines method structure and access.

60
New cards

Accessor

Specifies method visibility to other classes.

61
New cards

Public Accessor

Method accessible by any class.

62
New cards

Private Accessor

Method inaccessible to other classes.

63
New cards

Protected Accessor

Method accessible to subclasses only.

64
New cards

Return Type

Data type returned by the method.

65
New cards

Method Parameters

Inputs defined in parentheses of method.

66
New cards

Code Block

Enclosed in braces, contains method code.

67
New cards

First Iteration

Runs declaration and definition of variable.

68
New cards

Subsequent Iterations

Run conditional and iterator after first.

69
New cards

Loop Block

Code executed if condition is true.

70
New cards

Protected

Access modifier for subclasses and same package.

71
New cards

Static

Indicates class method versus instance method.

72
New cards

Return Type

Data type returned by a method.

73
New cards

Void

Indicates no data is returned by method.

74
New cards

Return Statement

Ends method execution and returns data.

75
New cards

Method Name

Descriptive identifier for a method's purpose.

76
New cards

Parameters

Input values required for method execution.

77
New cards

Method Signature

Combination of method name and parameter types.

78
New cards

Instance Method

Method called on an instance of a class.

79
New cards

Class Method

Method called on the class itself, not instances.

80
New cards

Primitive Data Types

Basic data types like int, double, boolean.

81
New cards

Object Data Types

Complex data types like String, Scanner, Integer.

82
New cards

Multiple Return Statements

More than one return statement in a method.

83
New cards

If Type Statement

Conditional statement that may contain return statements.

84
New cards

Method Declaration

Defines method name, return type, and parameters.

85
New cards

Internal Variable

Variable created within a method's scope.

86
New cards

Variable Scope

Lifetime and visibility of a variable in code.

87
New cards

Descriptive Naming

Using clear names for methods and variables.

88
New cards

Method Call

Invoking a method to execute its code.

89
New cards

Method Execution

Process of running a method's code.

90
New cards

Main Method

Entry point of a Java application.

91
New cards

Method Level

All methods exist at the same level in a class.

92
New cards

Parameter Data Type

Type specified before parameter name in declaration.

93
New cards

Method's Last Line

Should be a return statement unless void.

94
New cards

Method Signature

Defines method name and parameter data types.

95
New cards

Method Variable

Variable declared inside a method, limited scope.

96
New cards

Class Variable

Variable declared in class, accessible by all methods.

97
New cards

Parameter

Variable passed to a method for processing.

98
New cards

Method Overloading

Multiple methods with same name, different signatures.

99
New cards

Static Method

Method that belongs to the class, not instance.

100
New cards

Scope

Region where a variable is accessible.