CS 18000 Lecture Notes - Lecture 4: Exclusive Or, Null Pointer

14 views3 pages

Document Summary

Selection: by default, a list of statements , statement 1, statement 2, statement n, is executed in order, one after another, unless there is an error ( exception ), all statements are executed, we say, control flows sequentially. Control structures: language features (syntax) that affect the flow of control in a program, default control flow is sequential, control flow jumps to methods, then returns, various keywords introduce changes to the default flow, if, switch, while, for. Comparing strings: == between objects only compares the references (addresses) of the objects, two different string objects with the exact same characters will compare == false (since their objects are stored in different locations) if (s1. equals(s2)) Basic forms of the if statement if (boolean-expression) statement-if-true; if (boolean-expression) statement-if-true; else statement-if-false; Blocks and braces: use braces ({}) to group a sequence of statements into a single unit, already seen with method bodies and other examples, also can be use for control structures.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents